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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Running Total

I'm trying to calculate a running total but I can't get it for some reason. Here's what my setup is:


1.PNG

 

So as you can see it's not adding the previous months value to the next. Here's what my measures involved look like:

2.PNG

 

3.PNG

 

4.PNG

 

5.PNG

 

Any ideas?

 

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

Hi,

 

According to your description, I create four tables to test:

81.png   82.png   83.png   84.png

Please take following steps:

1)Create four measures:

Annual Producer Sum = CALCULATE(SUM(User[Annual_Producer_Goal_c]))

       Sum of Quota % max per Month = MAXX(KEEPFILTERS(VALUES('Quota Percentage'[Month])),CALCULATE(SUM('Quota Percentage'[Quota %])))

       * Quoted Revenue = CALCULATE([Annual Producer Sum]*[Sum of Quota % max per Month])

       * Cumulative Quoted Revenue =

       VAR maxd =

           MAX ( 'Date'[Date] )

       RETURN

           SUMX (

               SUMMARIZE (

                   FILTER ( ALLSELECTED ( 'Opportunity' ), 'Opportunity'[Value] <= maxd ),

                   'Opportunity'[Month & Year],

                   "Revenue", [* Quoted Revenue]

               ),

               [Revenue]

           )

2)The result shows:

85.png

Here is my test pbix file:

pbix 

 

Best Regards,

Giotto Zhi

View solution in original post

3 REPLIES 3
v-gizhi-msft
Community Support
Community Support

Hi,

 

According to your description, I create four tables to test:

81.png   82.png   83.png   84.png

Please take following steps:

1)Create four measures:

Annual Producer Sum = CALCULATE(SUM(User[Annual_Producer_Goal_c]))

       Sum of Quota % max per Month = MAXX(KEEPFILTERS(VALUES('Quota Percentage'[Month])),CALCULATE(SUM('Quota Percentage'[Quota %])))

       * Quoted Revenue = CALCULATE([Annual Producer Sum]*[Sum of Quota % max per Month])

       * Cumulative Quoted Revenue =

       VAR maxd =

           MAX ( 'Date'[Date] )

       RETURN

           SUMX (

               SUMMARIZE (

                   FILTER ( ALLSELECTED ( 'Opportunity' ), 'Opportunity'[Value] <= maxd ),

                   'Opportunity'[Month & Year],

                   "Revenue", [* Quoted Revenue]

               ),

               [Revenue]

           )

2)The result shows:

85.png

Here is my test pbix file:

pbix 

 

Best Regards,

Giotto Zhi

d_gosbell
Super User
Super User

So the filter in your cummulative measure looks wrong as it is comparing Opportunity[Value] to MAX(Date[Date])

 

The normal pattern would be:

* Cumulative Quote Revenue = CALCULATE([* Quoted Revenue], FILTER( ALL(Date[Date]), 'Date'[Date] <= MAX('Date'[Date]) ) )

 

But I don't think that will produce the correct result because it's effectively going to do SUM( Annual_Producer_Goal_c ) * MAX( [Quota %]) whereas I believe that you probably want to do SUM(  Annual_producer_Goal__c * [Quota &] )

 

The following expression will do the multiplication on a day by day basis then add the result.

* Cumulative Quote Revenue = SUMX( FILTER( ALL(Date[Date]), 'Date'[Date] <= MAX('Date'[Date]) ) ), [* Quoted Revenue] )

 

amitchandak
Super User
Super User

The formula seems correct unless there is issue with Opportunity value column.

If possible please share a sample pbix file after removing sensitive information.Thanks.

My Recent Blog -

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.