Short answer: write each KPI exactly once, as a measure in the semantic model with a description and a format. Then add one calculation group with items for current, year to date, last year and the change. Each item uses SELECTEDMEASURE(), so it works for every KPI: ten KPIs need ten measures plus four items, not fifty measures.
When each report builds its own revenue, two reports show two numbers for the same month, and a meeting starts with an argument about whose is right. When every KPI also needs a year-to-date and a last-year version, the measure list grows five times over, and one fix has to be made five times.
What does the model hold?
| KPI | You write | The group adds |
|---|---|---|
| Revenue | one measure | YTD, PY, Change % |
| Orders | one measure | YTD, PY, Change % |
| Average order | one measure | YTD, PY, Change % |
| Revenue YTD, Orders PY, ... | nine copies | no longer needed |
How do you write the measures?
One measure per KPI, named the way the business says it. Ratios divide two measures instead of repeating their logic:
Revenue = SUM ( Sales[Amount] )
Orders = DISTINCTCOUNT ( Sales[OrderID] )
Average order = DIVIDE ( [Revenue], [Orders] )Give each one a description (it shows when someone points at the field) and a format string, and put them in display folders. The model is now the one place a KPI is defined.
How does the calculation group work?
- 1MeasureRevenue, Orders, Average order
- 2ItemCurrent, YTD, PY, Change %
- 3SELECTEDMEASURE()the measure in the visual, with the item's filter
- 4Visuala column per item, or a slicer
Each item is a small DAX expression around whatever measure the visual uses:
-- Calculation group "Time", column "View"
Current = SELECTEDMEASURE ()
YTD = CALCULATE ( SELECTEDMEASURE (), DATESYTD ( 'Date'[Date] ) )
PY = CALCULATE ( SELECTEDMEASURE (), SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
Change % =
VAR Now = SELECTEDMEASURE ()
VAR Then = CALCULATE ( SELECTEDMEASURE (), SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
RETURN DIVIDE ( Now - Then, Then )In Power BI Desktop, create it in Model view with Calculation group; external tools such as Tabular Editor work too. Put the group's column on the columns of a matrix and every KPI on the rows shows all four views.
Change % should show as a percentage even when the KPI is a currency. A dynamic format string on that item does it: set its format to "0.0%", and leave the others on SELECTEDMEASUREFORMATSTRING () so they keep the measure's own format.
What goes wrong?
- Implicit measures stop working. Adding a calculation group turns on Discourage implicit measures, so dragging a raw column into a visual no longer sums it. That is the point: every number comes from a measure.
- No date table.
DATESYTDandSAMEPERIODLASTYEARneed a proper date table, marked as one, with a row for every day. Without it the time items return blanks or wrong numbers. - Items applied to the wrong measures. A ratio like
Average orderis fine, but a measure that already has its own time logic gets it twice. Keep time logic only in the group.
Where can you check this?
- Microsoft Learn: Create calculation groups in Power BI
- Microsoft Learn: SELECTEDMEASURE (DAX)
- Microsoft Learn: Set and use date tables in Power BI Desktop
Where do you start?
The open course DAX measures that add up starts with measures instead of columns, then CALCULATE and the date table these items need. For the KPIs themselves, with their formulas in DAX, SQL and Excel, KPI Atlas has 455 of them. The pattern sits on the map of my work.