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
yodha
Helper IV
Helper IV

Rolling Sum

Hi,

 

I want to calculate Rolling Sum for 3 months, starting form current month to past 2 months.

i have tried : 

Measure = CALCULATE([Count%],DATESINPERIOD('Date'[Date],LASTDATE('Table'[Date]),-3,MONTH))
Measure = CALCULATE([Count%],DATESINPERIOD('Date'[Date],MAX('Table'[Date]),-3,MONTH))
Measure = CALCULATE([Count%],DATESINPERIOD('Date'[Date],ENDOFTHEMONTH('Table'[Date]),-3,MONTH))
but none of these are working.

 

Any help on this much appreciated! Thank you.

1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @yodha ,

 

1. Create a relationship between the two tables.

v-lionel-msft_0-1595314134004.png

2. Create a measure like this.

Measure = 
CALCULATE(
    SUM('Table'[Count]),
    DATESINPERIOD( 'Date'[Date], MAX('Table'[Date]), -3, MONTH )
)

v-lionel-msft_1-1595314175390.png

The return value of the current month is equal to the sum of the current month and the previous two months.

v-lionel-msft_2-1595314264998.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

View solution in original post

2 REPLIES 2
v-lionel-msft
Community Support
Community Support

Hi @yodha ,

 

1. Create a relationship between the two tables.

v-lionel-msft_0-1595314134004.png

2. Create a measure like this.

Measure = 
CALCULATE(
    SUM('Table'[Count]),
    DATESINPERIOD( 'Date'[Date], MAX('Table'[Date]), -3, MONTH )
)

v-lionel-msft_1-1595314175390.png

The return value of the current month is equal to the sum of the current month and the previous two months.

v-lionel-msft_2-1595314264998.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

amitchandak
Super User
Super User

@yodha ,

Try like

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

 

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-Y...


Appreciate your Kudos.

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.