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
Anonymous
Not applicable

Rolling Sum issue - help

Hi, can someone help me to calculate the Rolling Sum (the last column in the below example). I have Pro Id, Year-month, Total Bonus for each Year-month, and few other columns in the visual as shown below. I need a Rolling Sum of Bonus (last column) for each Pro Id as shown in example below.

 

Tried the following DAX measure, but it's not giving me expected results. Please advise.

Rolling Sum Bonus = CALCULATE('Mesures Table'[Total Bonus], FILTER(ALLSELECTED(Table1),Table1[Pro Id]<=MAX(Table1[Pro Id])),FILTER(ALL('Date Dim'),'Date Dim'[Year-Month Code] <= MAX('Date Dim'[Year-Month Code]) && 'Date Dim'[Year] <= MAX('Date Dim'[Year])))

 

Pro IdNameAccount NameProfile NameYear-MonthTotal BonusRolling Sum Bonus
2200720 ALAMOAGH DISTSep-211770717707
2200720 ALAMOAGH DISTOct-211897.519604.5
2200720ABC IncALAMOAGH DISTFeb-222307.3621911.86
2200720ABC IncALAMOAGH DISTApr-221129.323041.16
2200720ABC IncALAMOAGH DISTJun-228806.731847.86
2200720ABC IncALAMOAGH DISTJul-2271332560.86
2200720ABC IncALAMOAGH DISTAug-22607.233168.06
2379628ABC IncXYZAGI IncOct-21638.94638.94
2379628ABC IncXYZAGI IncMar-2214262064.94
2379628ABC IncXYZAGI IncJun-22922156.94
2379628ABC IncXYZAGI IncJul-22577.32734.24
2 ACCEPTED SOLUTIONS

Hi,

Please try the below measure that I amended a little bit, and please check the attached file.

 

Rolling sum measure: =
IF (
    NOT ISBLANK ( [Total bonus measure:] ) && HASONEVALUE ( Data[Pro Id] ),
    CALCULATE (
        [Total bonus measure:],
        FILTER ( ALL ( Data ), Data[Pro Id] = MAX ( Data[Pro Id] ) ),
        'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
    )
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

Anonymous
Not applicable

Ecellent. It worked. Thank you!

 

Appreciated.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Ecellent. It worked. Thank you!

 

Appreciated.

Jihwan_Kim
Super User
Super User

Hi,

I am not quite sure if I understood your question correctly, but I assume you want to NOT show the rolling total result if the bonus is empty.
Please check the below picture and the attached pbix file.

I tried to create a sample pbix file that the datamodel looks like below.

I hope the below can provide some ideas on how to create a solution for your datamodel.

Jihwan_Kim_1-1664288088541.png

 

 

 

Jihwan_Kim_0-1664288063541.png

 

Rolling sum measure: =
IF (
    NOT ISBLANK ( [Total bonus measure:] ),
    CALCULATE (
        [Total bonus measure:],
        'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
    )
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Hi, Thanks for the code. But, the rolling sum messed up as soon as I added other columns, Account Name and Name. please see below, starting row 3 it started the new rolling sum, as this is part of same Pro Id, the rollowing should continue from Top.

please advise. Appreciate your help.

 

sy1164_0-1664289403638.png

 

Hi,

Please try the below measure that I amended a little bit, and please check the attached file.

 

Rolling sum measure: =
IF (
    NOT ISBLANK ( [Total bonus measure:] ) && HASONEVALUE ( Data[Pro Id] ),
    CALCULATE (
        [Total bonus measure:],
        FILTER ( ALL ( Data ), Data[Pro Id] = MAX ( Data[Pro Id] ) ),
        'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
    )
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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