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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

How do I calculate Cumulative Total for Prior Year?

I have cumulative total for current year working fine with

Cumulative Sales - CY = calculate ( sum(Transactions[RevenueAmountGBP]),filter(ALLSELECTED(Transactions),Transactions[PostingDate] <= max (Transactions[PostingDate])))
I also have a Sales for Prior Year
Sales - Prior Year = CALCULATE(SUM(Transactions[RevenueAmountGBP]), SAMEPERIODLASTYEAR('Date'[Date]))
But can't figure out how to get the corresponding amount using apply the date filter to the same period last year?
Any help would be greatly appreciated.
 
5 REPLIES 5
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could refer to the following measures:

Cumulative Sales - CY =
CALCULATE (
    SUM ( 'Transactions'[RevenueAmountGBP] ),
    FILTER ( ALLSELECTED ( 'Date' ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
)
Cumulative Sales - LY =
CALCULATE ( [Cumulative Sales - CY], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Anonymous
Not applicable

Thank you for your reply it’s very much appreciated.

I followed your steps and the Cumulative CY is working properly but the PY is only reporting the montly totals not the cumulative. Have I missed a step somewhere?

I set my CY as:

 

Cumulative Sales CY = calculate ( sum ( Transactions[RevenueAmountGBP] ), filter ( allselected ( 'date' ), 'Date'[Date] <= max ('Date'[Date])))

 

And my PY as:

 

Cumulative Sales PY = calculate ( [Cumulative Sales CY] , SAMEPERIODLASTYEAR('Date'[Date]))

 

Thanks so much

Hi @Anonymous ,

 

Could you please share your sample data here if you don't have any Confidential Information? Please upload your files to OneDrive for Business and share the link here.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
amitchandak
Super User
Super User

@Anonymous , Refer these

Cumulative example

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,date[date])))
Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=max(Sales[Sales Date])))

till last year

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,max(dateadd(date[date]),-1,year))))

 

not sure if you are looking for ytd

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello, 
I have tried to calculated only previous year cumulative sales, But unable to achive, i tried the formula which is given above but i am unable to get the output. Below dax is giving me till todays month data , i want restrict only for the laste year. 

LastYearAccumulativeRevenue =
CALCULATE(
SUM([amount]),
YEAR('Date'[Date]) = YEAR(TODAY())-1,
'Date'[Date]<= MAX('Date'[Date])
)

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.

Top Solution Authors