Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
What should be difference
Dax1 =
Solved! Go to Solution.
Hi @RajCZ ,
The difference between the two DAX formulas lies in how they handle the year filtering, and the behavior of Dax2 can lead to unintended results.
You can modify your formula like below, it can get the same result:
Dax1 =
VAR Yr = MAX('Date'[Year]) - 1
RETURN CALCULATE(SUM(Sales[Sale]), 'Date'[Year] = Yr)
Dax2 =
CALCULATE(
SUM(Sales[Sale]),
'Date'[Year] = MAX('Date'[Year]) - 1
)
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Yes, I know I can update like that, but I am just wondering what is value that I see in DAX2, may be I can find a sceanrio in future where that type of calculation be useful.
Thanks
Hi @RajCZ ,
In DAX2, you directly use CALCULATE to filter the SUM(Sales[Sale]) measure where the 'Date' table's year is equal to the maximum year in your 'Date' table minus 1. This means it's trying to filter for the year Yr - 1 where Yr is the maximum year in your 'Date' table.
CALCULATE(SUM(Sales[Sale]), 'Date'[Year] - 1)
Implicit Context in DAX2: DAX2 subtracts 1 from the 'Date'[Year] column without specifying a condition for CALCULATE. It filters for the year that is one less than the maximum year in the entire 'Date' table, not the year before the maximum year in context.
In short, there are very few scenarios in which dax2 would be written in such a way that it would produce unexpected results
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @RajCZ ,
The difference between the two DAX formulas lies in how they handle the year filtering, and the behavior of Dax2 can lead to unintended results.
You can modify your formula like below, it can get the same result:
Dax1 =
VAR Yr = MAX('Date'[Year]) - 1
RETURN CALCULATE(SUM(Sales[Sale]), 'Date'[Year] = Yr)
Dax2 =
CALCULATE(
SUM(Sales[Sale]),
'Date'[Year] = MAX('Date'[Year]) - 1
)
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.