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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Zarlot531
Helper V
Helper V

Rolling sum sort of works, but presents the same number despite year.

I'm trying to get a "rolling" measure by sold year/month. The below $841,469 correctly rolls 0 and 1 together (274,816+566,652) BUT it incorrectly (or unwantedly) puts that same number in each year, where, for 2016 for example i want (65,807 + 155,318 = 221,125) 

 

Capture8890.JPG

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

Hi @Zarlot531 ,

 

Please update your measure as below by adding VALUES function.

 

Rollingsum = 
SWITCH (
    SELECTEDVALUE ( Query1[Lag2] ),
    "1", CALCULATE (
        SUM ( Query1[RMR] ),
        FILTER ( ALL ( Query1 ), Query1[Lag2] = "0" || Query1[Lag2] = "1" ),
        VALUES ( 'Query1'[SoldMonth].[Year] )
    )
)

 

Capture.PNG

 

For more details, please check the pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

4 REPLIES 4
v-frfei-msft
Community Support
Community Support

Hi @Zarlot531 ,

 

Please update your measure as below by adding VALUES function.

 

Rollingsum = 
SWITCH (
    SELECTEDVALUE ( Query1[Lag2] ),
    "1", CALCULATE (
        SUM ( Query1[RMR] ),
        FILTER ( ALL ( Query1 ), Query1[Lag2] = "0" || Query1[Lag2] = "1" ),
        VALUES ( 'Query1'[SoldMonth].[Year] )
    )
)

 

Capture.PNG

 

For more details, please check the pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
MFelix
Super User
Super User

Hi @Zarlot531 ,

 

How are you calculating your information? What is the measure you are using for the rolling average?

 

Can you share a sample data?

 

Please see this post regarding How to Get Your Question Answered Quickly:

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490 (courtesy of @Greg_Deckler).

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Below is a link to data. It's actually a rolling sum I'm looking for to eventually build a rolling % to total installed by month lag. 

 

Like below, the chart is constructed using similar data. The Power BI chart doesn't need to look exactly like this, but this is the basic idea. This is Orders by month but there's usually a lag for when the orders get "installed" or "implemented." I'd like to know, for example, that, say, 50% of our orders have been installed by month 3 instead of knowing what % happened in month 3 alone. To do this, I need rolling sums by month lag by month sold. Also, I've posted elsewhere but while everyone has been very helpful and I appreciate their help, nobody has been able to solve this conundrum. I've tried hard myself but just can't get there. 

 

https://community.powerbi.com/t5/Desktop/Rolling-sums-but-on-a-text-field/m-p/885456#M424381

 

Capture454.JPG

 

https://www.dropbox.com/s/a5ppegph8bbgdik/DataShare.xlsx?dl=0 

this has now been solved at the link I listed above. 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors