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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JMSNYC
Helper III
Helper III

Rolling Sum of a Cumulative Total

Hello again.

 

Still cannot figure out the DAX to solve my issue:

 

First column is yearmonth

 

Second column is monthly sales

 

Third column is cumulative sales since the launch of the product (e.g., 659 = 655+4), calculated via the following Measure:

Cumulative_Sales = CALCULATE('FACT'[Sales],FILTER(ALLSELECTED('FACT'),'Calendar'[Date]<=max('Calendar'[Date])))
 

Fourth column is rolling 3 month sum of Second column (e.g. 64 = 28+4+32), calculated via the following Measure

3M_Rolling_Sales =
CALCULATE (sum('FACT'[Sales]),DATESINPERIOD ('Calendar'[Date],LASTDATE ( 'Calendar'[Date] ),-3,MONTH))
 
Fifth column ... WHAT IS THE MEASURE'S EXPRESSION for the 3M_Rolling_CUMULATIVE_Sales? I cannot generate it
3M_Rolling_CUMULATIVE_Sales ... i.e. for 201905 ... I should have: 687+659+655 = 2,001

e7fa3d79a00a6a76b284ff12093836c9.png

 

Could anyone please help ?

Thank you in advance.

1 ACCEPTED SOLUTION

@JMSNYC 

 

Sorry, I'm not sure what you mean. I believe the measure creates a cumulative sum of your rolling 3 month sales.

"Fifth column ... WHAT IS THE MEASURE'S EXPRESSION for the 3M_Rolling_CUMULATIVE_Sales?"

Isn't that what you need?

cumulsales.JPG

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

6 REPLIES 6
PaulDBrown
Community Champion
Community Champion

@JMSNYC 

Try:

 

3 Month Cumulative =
SUMX (
    SUMMARIZE (
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
        ),
        'Calendar'[YearMonth],
        "3MonthRSales", [3M_Rolling_Sales]
    ),
    [3MonthRSales]
)

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Getting close: This created the cumulative sum of the total column since product launch. How limit that to a 3 month rolling sum ?

@JMSNYC 

 

Sorry, I'm not sure what you mean. I believe the measure creates a cumulative sum of your rolling 3 month sales.

"Fifth column ... WHAT IS THE MEASURE'S EXPRESSION for the 3M_Rolling_CUMULATIVE_Sales?"

Isn't that what you need?

cumulsales.JPG

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Awesome ! Actually it worked great. Previous issue was myy mistake. Was taking the wrong variable !!

amitchandak
Super User
Super User

@JMSNYC , Create a measure like this with date table and try

 

Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-3,MONTH))

Unfortunately, it does not work. This is the formula I used in Column 4 (with LASTDATE vs. MAX), but still gives me same output 😞

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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