Skip to main content
Albero Academy

Common DAX Patterns

The measures every report needs — percentage of total, running total, year-over-year growth, ranking and moving averages.

Chapter 12Power BI16 min readBeginner friendly
  • #Power BI
  • #DAX
  • #Patterns

A handful of measure patterns appear in almost every report. Learn these five and you can build the majority of real dashboards — they combine everything so far: CALCULATE, filter modifiers, time intelligence and iterators.

Percentage of total

share of the whole
% of Total =
DIVIDE(
[Total Sales],
CALCULATE([Total Sales], ALL(Product)) -- total ignoring the row's filter
)
-- The denominator strips the current filter, so each row shows its share.

Running total

cumulative to date
Running Total =
CALCULATE(
[Total Sales],
FILTER(ALL('Date'), 'Date'[Date] <= MAX('Date'[Date]))
)
-- All dates up to and including the current one → a cumulative line.

Year-over-year

Comparisons against the prior period lean on time intelligence (Chapter 4):

growth vs last year
Sales LY = CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date]))
YoY % = DIVIDE([Total Sales] - [Sales LY], [Sales LY])
-- Positive = growth; needs a proper Date table.

Moving average

smoothing a trend
3-Month Avg =
AVERAGEX(
DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -3, MONTH),
[Total Sales]
)
-- Average of the measure over the trailing 3 months.

Practice

Build a % of Total measure and confirm the percentages sum to 100%. Add a cumulative Running Total line by month, a YoY % using SAMEPERIODLASTYEAR, and a 3-month moving average. Put them all on one report.

Key takeaways

  1. 01% of total: DIVIDE(measure, CALCULATE(measure, ALL(dim))) — strip the filter in the denominator.
  2. 02Running total: CALCULATE(measure, FILTER(ALL(Date), Date <= MAX(Date))).
  3. 03Year-over-year: compare to SAMEPERIODLASTYEAR, then DIVIDE the difference.
  4. 04Moving average: AVERAGEX over DATESINPERIOD for a trailing window.
  5. 05Most patterns are CALCULATE/X-function + a filter modifier reshaping context — a reusable shape.