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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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/
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @v-shex-msft

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)

 

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.