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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Solved! Go to Solution.
Hi @afaro
Why not try the following few measures if you have a calander table in your data model,.
Base Sales Measure
Sales = SUM(Sales[Total])
YTD Sales
Sales - YTD = TOTALYTD([Sales], Calendar[Date])
PY Sales
Sales - PY =
CALCULATE([Sales - YTD], DATEADD(Calendar[Date], -1, YEAR))
Joe
If you found my answer helpful and it solved your issue, please accept as solution
Proud to be a Super User! | |
Date tables help! Learn more
Hi, @afaro
The problem with the first formula is the use of functions. Retains filters for all columns except the specified columns. In this case, you keep the filter, but remove all other columns (including .which is why your formula isn't filtered by the previous year as expected.) Instead, it calculates the total sales for all years, but doesn't filter by month as you might expect.
The correct logic you're looking for is to calculate the total sales for the same month but the previous year relative to the year selected in the slicer. Your second formula is more in line with this goal
However, to understand why the first formula doesn't work as intended, it's crucial to grasp how things work in a function. In your scenario, you want to keep the month filter, but move to the previous year, which isn't effectively communicated in the first formula.
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @afaro
The problem with the first formula is the use of functions. Retains filters for all columns except the specified columns. In this case, you keep the filter, but remove all other columns (including .which is why your formula isn't filtered by the previous year as expected.) Instead, it calculates the total sales for all years, but doesn't filter by month as you might expect.
The correct logic you're looking for is to calculate the total sales for the same month but the previous year relative to the year selected in the slicer. Your second formula is more in line with this goal
However, to understand why the first formula doesn't work as intended, it's crucial to grasp how things work in a function. In your scenario, you want to keep the month filter, but move to the previous year, which isn't effectively communicated in the first formula.
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @afaro
Why not try the following few measures if you have a calander table in your data model,.
Base Sales Measure
Sales = SUM(Sales[Total])
YTD Sales
Sales - YTD = TOTALYTD([Sales], Calendar[Date])
PY Sales
Sales - PY =
CALCULATE([Sales - YTD], DATEADD(Calendar[Date], -1, YEAR))
Joe
If you found my answer helpful and it solved your issue, please accept as solution
Proud to be a Super User! | |
Date tables help! Learn more
Have you considered using SAMEPERIODLASTYEAR instead?
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
14 | |
11 | |
10 | |
10 |