Skip to content

Performance: measure before optimizing

Correctness comes first. A faster expression answering a different question is a regression, not an optimization.

Capture a repeatable baseline

Use Power BI Performance Analyzer to identify a slow visual and inspect its query. Use DAX Studio connected to the intended model for supported Server Timings/query-plan inspection. Keep report rendering time distinct from engine query time.

Record model size, storage mode, engine version, query, slicers, row count, result values, and repeated timings. Separate cold-cache from warm-cache measurements; do not clear a shared production cache for a tutorial.

Compare a stored amount and an iterator

The source library supplies Revenue (SUM of SalesAmount) and Revenue Iterator (SUMX of Quantity * UnitPrice). Both should return 9500 on the fixture.

The 12-row sample is for correctness and concepts, not a convincing performance benchmark. In a realistic model, measure cardinality and workload rather than declaring SUMX universally bad or a particular model universally fast.

Improvements worth investigating

  • Reduce unnecessary columns/high-cardinality text in the model.
  • Use a clear star schema and appropriate relationships.
  • Prefer a dimension Boolean filter when it expresses the requirement.
  • Avoid unnecessarily iterating a large table repeatedly.
  • Use variables for repeated evaluations while respecting their context.
  • Keep numeric measures numeric; FORMAT returns text and can change sorting and downstream behavior.
  • Benchmark Import/DirectQuery/composite models within their own constraints.

Changing an iterator to a simple aggregate, shrinking a filter table, or moving a calculation to refresh can change semantics. Validate row, subtotal, total, blank, and filter-selection behavior before accepting it.

A practical experiment

  1. Run totals/check queries and record results.
  2. Profile equivalent SUM/SUMX expressions in a suitable larger approved model.
  3. Repeat the same filter state and distinguish warm/cold runs.
  4. Inspect whether the bottleneck is model/query/source/rendering.
  5. Keep or reject a change based on measured improvement and matching answers.

Do not fabricate benchmark numbers from this repository's CI. CI does not host a DAX engine or measure VertiPaq behavior. Reference: optimization guidance and DAX Studio.