Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
GrimReaperX
Helper II
Helper II

Last year calculation does not work properly

Hello, 

 

I am trying to calculate last year revenue and orders but formula triggers different result than expected.

GrimReaperX_0-1677147649683.png

I also used sameperiodlastyear formula but it gives the same result. 
For total orders, i used distinct count of orders.

Could you please help? 


Thanks.

2 REPLIES 2
MAwwad
Solution Sage
Solution Sage

Hello,

It looks like the issue with your formula might be that it's not filtering by the current year. When you use the TOTALYTD function, it returns a cumulative total of the measure for the specified year up to the specified date. However, in your formula, you're not specifying the current year, so it's returning the total for all years.

To fix this, you can add a filter to your formula to only consider the current year. Here's an example formula that you can use:

Last Year Revenue = CALCULATE( [Total Revenue], FILTER( ALL('Date'[Year]), 'Date'[Year] = YEAR(TODAY()) - 1 ) )

This formula uses the CALCULATE function to calculate the total revenue, but it also includes a FILTER function that filters the results to only include the previous year. You can use a similar formula for the total orders.

I hope this helps! Let me know if you have any further questions.

Hello, thanks for your reply. However, i've already tried to use this formula earlier and it returns value for last year which eventually affects all lines. The only problem is the last year value, the previous years are shown correct based on DATEADD or SAMEPERIODLASTYEAR. 

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.