Calculation groups

Last checked against Microsoft documentation: 14 November 2026

A calculation group is a set of reusable calculation items, such as Year to date or Prior year, that you apply to any existing measure. It replaces dozens of near-identical time-intelligence measures with one group. Calculation groups work at compatibility level 1500 and higher, which covers all Power BI semantic models, and they work only with explicit measures.

Why it matters

  • Ten measures shown as six time views is 60 measures the old way. With a calculation group it is 10 measures plus one group of 6 items.
  • One fix to a rule (say, how Prior year is computed) updates every measure at once.
  • Each item can change the display format, so a percentage item shows as a percentage while the others show as numbers.

Step by step (Model view only)

  1. Open your model in Power BI Desktop, or edit it in the browser, and go to Model view.
  2. Select Calculation group in the ribbon.
  3. If Power BI asks about Discourage implicit measures, choose Yes. The question only appears when the setting is off.
  4. Rename the group and its column. The column is what people drag into visuals and slicers.
  5. Type the DAX for the first item. By default it is SELECTEDMEASURE (), which means "the measure being shown, unchanged".
  6. Right-click Calculation items and choose New calculation item for each extra item. Reorder them in the Properties pane.
  7. For an item that needs its own format, select it and switch on Dynamic format string.
  8. Test it. In a matrix, put Month on rows, the calculation group column on columns and one measure in values. Or place the column in a slicer to apply one item to many measures.

Example: a Time Intelligence group

Name the group Time Intelligence and its column Time Calculation. Add these items:

DAX
// Item: Current
SELECTEDMEASURE ()

// Item: YTD
CALCULATE ( SELECTEDMEASURE (), DATESYTD ( 'Date'[Date] ) )

// Item: PY (prior year)
CALCULATE ( SELECTEDMEASURE (), SAMEPERIODLASTYEAR ( 'Date'[Date] ) )

// Item: YOY (change vs prior year)
SELECTEDMEASURE ()
    - CALCULATE ( SELECTEDMEASURE (), 'Time Intelligence'[Time Calculation] = "PY" )

// Item: YOY% (change as a percentage)
DIVIDE (
    CALCULATE ( SELECTEDMEASURE (), 'Time Intelligence'[Time Calculation] = "YOY" ),
    CALCULATE ( SELECTEDMEASURE (), 'Time Intelligence'[Time Calculation] = "PY" )
)

For the YOY% item, turn on Dynamic format string and enter an expression that returns text, such as the text 0.00%. In DAX that is written with quotes: "0.00%".

To use one item inside an ordinary measure, filter on the group column:

DAX
Orders YOY% = CALCULATE ( [Orders], 'Time Intelligence'[Time Calculation] = "YOY%" )

Limiting an item to some measures

Use ISSELECTEDMEASURE to apply an item only to chosen measures and leave the rest alone:

DAX
// Item: YTD (money measures only)
IF (
    ISSELECTEDMEASURE ( [Total Sales], [Total Cost] ),
    CALCULATE ( SELECTEDMEASURE (), DATESYTD ( 'Date'[Date] ) ),
    SELECTEDMEASURE ()
)

The four helper functions are:

FunctionWhat it returns
SELECTEDMEASURE ()The measure currently being calculated
SELECTEDMEASURENAME ()That measure's name, as text
ISSELECTEDMEASURE ( ... )True if the current measure is in your list
SELECTEDMEASUREFORMATSTRING ()That measure's own format string

Precedence: the rule that surprises people

When a model has two or more calculation groups, precedence decides the order. The group with the higher number is applied first, on the outside, and the lower group sits inside it. The result is nested, not step-by-step arithmetic.

Worked example with a base measure [Base] = 5:

GroupPrecedenceItem formula
Adjust10SELECTEDMEASURE () + 1
Scale20SELECTEDMEASURE () * 3

With one item from each group selected, Scale wraps Adjust: (5 + 1) * 3 = 18. It is not 5 * 3 + 1 = 16.

A real case from Microsoft's documentation: Time Intelligence has precedence 20 and an Averages group has 10. Choosing YTD and Daily Average together applies YTD to both the total and the day count inside the average. The result is not "YTD total divided by all days".

Selection expressions: what happens when the selection is odd

A calculation group applies only when exactly one of its items is in the filter context. Two optional expressions handle the other cases.

What the user didNo expression definedExpression defined
Selected one itemThe item is appliedThe item is applied
Selected several items, or an item that does not existNo calculation appliedmultipleOrEmptySelectionExpression is used
Selected nothingNo calculation appliednoSelectionExpression is used

The model setting selectionExpressionBehavior has three values. Automatic (default) acts like Nonvisual. Nonvisual returns SELECTEDMEASURE () and hides subtotals when grouped by the calculation group. Visual returns BLANK () when no multi-selection expression exists and evaluates subtotals against the selected measure.

Dynamic format strings: how they combine

  • A format string expression must return one text value.
  • To fall back to the measure's own format, use SELECTEDMEASUREFORMATSTRING () as the default branch.
  • Only the format string from the highest-precedence group is used.
  • A calculation group's format string beats a measure's own dynamic format string.

Items can refer to each other

Items in the same group may reference one another (YOY% uses YOY and PY, as above). Each reference runs in its own CALCULATE. Other kinds of recursion are not supported.

Watch-outs

  • Explicit measures only. Once a group exists, Power BI hides the sum symbol on data columns and blocks adding raw columns as values. Existing implicit measures keep working.
  • Variant data type. After you add a group, report measures use the variant type. A dynamic format string that reuses a measure can then fail. Wrap it as FORMAT ( [Your measure], "" ), or share the expression through a DAX user-defined function (see Lesson 1).
  • Text measures. Math on a non-numeric measure raises Cannot convert value of type Text to type Numeric. Guard with IF ( ISNUMERIC ( SELECTEDMEASURE () ), ..., SELECTEDMEASURE () ).
  • Security. You cannot define row-level security on a calculation group, directly or indirectly. Object-level security on the group's own table is not supported either. An item that uses an OLS-secured object returns a generic error.
  • Not supported: Detail Rows Expressions, smart narrative visuals, and implicit column aggregations.
  • Live connection: dynamic format strings are not applied to report-level measures.
  • Composite models: calculation groups on remote sources are not supported and give undefined results (see Lesson 5).

Official sources