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
talitanieps
Advocate I
Advocate I

How to calculate a cumulative total from a calculated column?

Hello!

I'm having a hard time to calculate the running / cumulative total of average values...
My idea is to emulate a sales campaign for a product that never had one, using the average by day of all the products from an specific brand; problem is the code I made is only repeating the numbers from the average, it's not summing them up:

This is how it's now:

talitanieps_0-1674402761508.png


This is how it should be:

talitanieps_1-1674402778975.png

 

I managed to filter the values I want to calculate the average for, and that's for an specific brand (this is not going to be replicated to all products, and in the end I want to merge this in another calculated column which will calculate the goal for all the products (including the exception, which are the ones that never had a sales campaign before).

here's the code for the average:


AllPlutoProductsAverage = MAXX(FILTER('f_Leads(teste2)', [percentage] = EARLIER(d_CT_Leads_RT[percentage]) && 'f_Leads(teste2)'[group_name]="Pluto"), 'f_Leads(teste2)'[registers_per_day] )


And here's the code for the cumulative/running total column:

 

VAR _NoCampaign_RT =
    CALCULATE(
        MAX( 'd_CT_Leads_RT'[AllPlutoProductsAverage ] ) ,
        FILTER( 'f_Leads(teste2)' ,
                AND( 'f_Leads(teste2)'[group_name] = d_CT_Leads_RT[group_name] ,
                    'f_Leads(teste2)'[course] = d_CT_Leads_RT[course]
                ) &&'f_Leads(teste2)'[course_closed_percentage] = d_CT_Leads_RT[percentage]
        )
    )


Any ideas on how I fix that...?
Thanks in advance!! 🙂


5 REPLIES 5
Padycosmos
Solution Sage
Solution Sage
Ashish_Mathur
Super User
Super User

Hi,

Your question is not clear.  There is no Date column there at all.  Give a proper explanation of the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello!

Thanks for the replies! I'll review the video in a bit...
About the date column, what happens is that we track the campaigns duration as percentage, which uses the date to calculate every percentual point, but in reality we use date indirectly for our running totals calculation. So, consider my 'date' column the percentage one.

All I want the code to do is to sum up the averages per percentual point I demonstrated here, which for some reason I can't make it work..... 

talitanieps_0-1674472441799.png

 

Greg_Deckler
Community Champion
Community Champion

@talitanieps Not completely following this and not sure how you arrive at your desired values, but this may help:

Better Running Total - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hii, 
Thanks for your reply - I watched the video and liked your approach to use a different way to calculate the running total without using CALCULATE; however, it didn't work for me... it gave me higher higher numbers than expected.

Any other idea on how I can propagate the mean/average of a series of numbers into a running total/cumulative total formula?? 
Thanks in advance!

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