Calculation Groups

Power BI · Advanced Features

Theory

A calculation group is a special table whose rows, called calculation items, are reusable DAX patterns applied to whichever measure is in the visual. Inside an item, SELECTEDMEASURE() stands for 'the current measure'. An item named YTD with the expression CALCULATE(SELECTEDMEASURE(), DATESYTD('Date'[Date])) turns Total Sales into YTD Sales, Total Qty into YTD Qty, and so on, without writing a separate YTD measure for each.

You put the calculation group column on a matrix's columns or a slicer, and each item modifies the measure. For March 2024 in the sample data, Current shows ₹2,200, YTD shows ₹5,700, PY (same period last year) ₹2,500 and YoY % −12.0%. Calculation groups can be created in Model view in Desktop or with external tools such as Tabular Editor; creating one turns on the model's 'discourage implicit measures' setting, so only explicit measures work with it.

Why we use it

Without calculation groups, ten base measures times five time comparisons means fifty measures to write and maintain. Calculation groups collapse that into ten measures plus five items.

When to use it

Use them when the same transformation (time intelligence, currency conversion, scenarios) applies to many measures. Avoid them for one-off logic; they add an abstraction that can confuse new model authors.

How it works

  1. Many measures need the same variants
  2. Create a calculation group in Model view
  3. Add items using SELECTEDMEASURE()
  4. Set format strings for ratio items
  5. Is the group placed on a visual or slicer? Yes: Each item rewrites the measure in context. No: Measures show their normal value.
  6. Fewer measures, consistent logic

Syntax

Model view → Home → Calculation group (first item opens in the formula bar)
More items: right-click Calculation items → New calculation item
Item expression uses SELECTEDMEASURE()
Other functions: SELECTEDMEASURENAME(), SELECTEDMEASUREFORMATSTRING(), ISSELECTEDMEASURE()
Alternatives: TMDL view, Tabular Editor (external tool)

Example

// Calculation group 'Time Calc', column 'Time Calc'
Current = SELECTEDMEASURE()
YTD     = CALCULATE(SELECTEDMEASURE(), DATESYTD('Date'[Date]))
PY      = CALCULATE(SELECTEDMEASURE(), SAMEPERIODLASTYEAR('Date'[Date]))
YoY %   = 
    VAR Cur = SELECTEDMEASURE()
    VAR Prev = CALCULATE(SELECTEDMEASURE(), SAMEPERIODLASTYEAR('Date'[Date]))
    RETURN DIVIDE(Cur - Prev, Prev)
// YoY % item: set a format string expression of "0.0%"

Key points

Power BI topics

Power BI Introduction

Getting Data

Power Query (Data Transformation)

Data Modeling

DAX (Data Analysis Expressions)

Data Visualization

Dashboards & Reports

Power BI Service

Advanced Features

Projects & Case Studies

Interview & Certification

Advanced DAX & Time Intelligence

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Power BI Dashboards & DAX

Learn data visualization and interactive dashboards step-by-step. Click any topic in the sidebar to open it right here.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Hands-on practice Practice DAX Online 250 business scenarios on a star schema — write a measure and compare your visual with the expected one. Start practising →
Section {{ sec.num }}

{{ sec.label }}

Power BI  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

Theory

{{ current.def }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
On screen — where to click

{{ rich.ui.title }}

{{ u.text }}
  1. {{ st.n }}{{ st.text }}
{{ rich.ui.title }}
{{ u.text }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
Syntax / Where to find it
{{ current.syntax }}
Example
{{ current.example }}
What You'll Learn — click to check off
  • {{ pt.mark }} {{ pt.text }}

Share this topic