Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more
I have a simple measure that gets the total sales for the given year:
Total Sales (YTD) = CALCULATE(SUM([Sales Amount]), DATESYTD('Calendar'[Date]))I have another measure where I would like to use the same date calculation, but instead use a different calculation:
Total Orders (YTD) = CALCULATE(COUNTROWS('Sales'), DATESYTD('Calendar'[Date]))In this case, the filter calculation is quite simple as DATESYTD takes care of the heavy lifting. Copy/pasting the DATESYTD calcuation between measures isn't difficult or cumbersome. However, I have other date filters that are much more complex and need to be used in multiple measures.
How can I create a reusable (date) filter to use on multiple measures?
Few ideas:
Solved! Go to Solution.
I would recommend using Calculation Groups here.
Calculation Groups can be used to apply common modifications to multiple measures, with time intelligence being a common example.
The nice thing about Calculation Groups is that they can be applied either by a filter in the report, or by applying a filter in a DAX expression.
In your case, you could create a Calculation Group with a Calculation Item for each date filter. You can then apply a particular date filter to a calculation by filtering on the Calcualation Item by name, avoiding having to rewrite the DAX each time.
Here is an example of a calculation group (using DAX Script from Tabular Editor) with 5 Calculation Items:
-----------------------------------------------------
-- Calculation Group: 'Date Filter Calculation Group'
-----------------------------------------------------
CALCULATIONGROUP 'Date Filter Calculation Group'[Date Filter]
CALCULATIONITEM "Default" = SELECTEDMEASURE ()
Ordinal = 0
CALCULATIONITEM "YTD" =
CALCULATE (
SELECTEDMEASURE (),
DATESYTD ( 'Date'[Date] )
)
Ordinal = 1
CALCULATIONITEM "Full Year" =
CALCULATE (
SELECTEDMEASURE (),
PARALLELPERIOD ( 'Date'[Date], 0, YEAR )
)
Ordinal = 2
CALCULATIONITEM "Previous Full Year" =
CALCULATE (
SELECTEDMEASURE (),
PREVIOUSYEAR ( 'Date'[Date] )
)
Ordinal = 3
CALCULATIONITEM "YTD as at TODAY" =
CALCULATE (
SELECTEDMEASURE (),
CALCULATETABLE (
DATESYTD ( 'Date'[Date] ),
'Date'[Date] = TODAY ()
)
)
Ordinal = 4
Having created this Calculation Group, you can then apply a Calculation Item within a measure such as:
Sales Quantity YTD =
CALCULATE (
[Sales Quantity],
'Date Filter Calculation Group'[Date Filter] = "YTD"
)
You can also filter on a particular Calculation Item in the report to apply it to multiple measures at a report/page/visual level.
For general background on Calculation Groups, there are various articles such as:
https://www.sqlbi.com/calculation-groups/
Regards
I would recommend using Calculation Groups here.
Calculation Groups can be used to apply common modifications to multiple measures, with time intelligence being a common example.
The nice thing about Calculation Groups is that they can be applied either by a filter in the report, or by applying a filter in a DAX expression.
In your case, you could create a Calculation Group with a Calculation Item for each date filter. You can then apply a particular date filter to a calculation by filtering on the Calcualation Item by name, avoiding having to rewrite the DAX each time.
Here is an example of a calculation group (using DAX Script from Tabular Editor) with 5 Calculation Items:
-----------------------------------------------------
-- Calculation Group: 'Date Filter Calculation Group'
-----------------------------------------------------
CALCULATIONGROUP 'Date Filter Calculation Group'[Date Filter]
CALCULATIONITEM "Default" = SELECTEDMEASURE ()
Ordinal = 0
CALCULATIONITEM "YTD" =
CALCULATE (
SELECTEDMEASURE (),
DATESYTD ( 'Date'[Date] )
)
Ordinal = 1
CALCULATIONITEM "Full Year" =
CALCULATE (
SELECTEDMEASURE (),
PARALLELPERIOD ( 'Date'[Date], 0, YEAR )
)
Ordinal = 2
CALCULATIONITEM "Previous Full Year" =
CALCULATE (
SELECTEDMEASURE (),
PREVIOUSYEAR ( 'Date'[Date] )
)
Ordinal = 3
CALCULATIONITEM "YTD as at TODAY" =
CALCULATE (
SELECTEDMEASURE (),
CALCULATETABLE (
DATESYTD ( 'Date'[Date] ),
'Date'[Date] = TODAY ()
)
)
Ordinal = 4
Having created this Calculation Group, you can then apply a Calculation Item within a measure such as:
Sales Quantity YTD =
CALCULATE (
[Sales Quantity],
'Date Filter Calculation Group'[Date Filter] = "YTD"
)
You can also filter on a particular Calculation Item in the report to apply it to multiple measures at a report/page/visual level.
For general background on Calculation Groups, there are various articles such as:
https://www.sqlbi.com/calculation-groups/
Regards
This is exactly what I was looking for, thank you so much!
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |