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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Niks_S
Frequent Visitor

Prior Year 12 rolling month cumulative sales,

Hi,

I need a dax to calculate cumulative sales of Prior Year (which is -12 month)-12 month.

 

I used this dax to get -12M rolling cumulative sales

YTD_SALES_tag cy =
CALCULATE([Sales SUM],
    FILTER(
        ALL('Date Table'),
        And('Date Table'[Date]<= Max('Date Table'[Date]),
            'Date Table'[Date]>eomonth(CALCULATE(MAX('Date Table'[Date]), ALLSELECTED('Date Table')),-12)
          )
        )
 
 Now need to find cumulative sales 2023Feb to 24 Jan
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

Measure = calculate([sales SUM],datesbetween('Date table',edate(min('date table'[date]),-11),max('date table'[date])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

Measure = calculate([sales SUM],datesbetween('Date table',edate(min('date table'[date]),-11),max('date table'[date])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Niks_S,

If the time intelligence function not fully works for your requirement, you can also tied to manually define a variable to calculate previous date and use in calculations:

YTD_SALES_tag cy =
VAR currDate =
    MAX ( 'Date Table'[Date] )
RETURN
    CALCULATE (
        [Sales SUM],
        FILTER (
            ALLSELECTED ( 'Date Table' ),
            'Date Table'[Date] <= currDate
                && 'Date Table'[Date]
                    > DATE ( YEAR ( currDate ), MONTH ( currDate ) - 12, DAY ( currDate ) )
        )
    )

BTW, how did the [Sales SUM] expression calculated? Can you please share some more detail?

Regards,

Xiaoxin Sheng

Hi @Anonymous, 

Thank you for your reply

The sales Sum is raw data, calculated with calculate Sum dax.

 

I want to have rolling cumulative 12 M of previous to previous year numbers (Like i did for previous 12 M)

 

Anonymous
Not applicable

Hi @Niks_S ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

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.