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
tmau
Regular Visitor

Running total using a measure

Hello everyone,

first post in this wonderful community, I do apologise if some information will be missing or won't be 100% clear, I will try my best.
I would like to create a running total that originates from a measure (I have read several topics on this forum, but I can't get my head around it).

I have 2 tables and some measures, couple of filters, I have attached a picture:

tmau_0-1717487558325.png

 

There is one single relation (1 to many) in between VIN columns:

tmau_1-1717487692459.png

 

Measure of the model:

vehs = DISTINCTCOUNT('V-I'[VIN])
jobs = DISTINCTCOUNT(W[JOB_ID])
rpt = CALCULATE(DIVIDE([jobs],[vehs]))
 
As you can see from the 1st picture, the calculation of the "global" rpt is correct (5/8=0.63) and rpt per age can be plotted properly as well. If I use the quick measure to create a running total on any of columns, it works; if I use it to create the running total on the rpt, it doesn't (at least, I was not able to make it work).

I would like to have a running total of the rpt, the result should be (considering the applied filters, as per picture):
Age      RPT       RPT cumulated
3          0.67       0.67
6          1.00       1.67
9          0.50       2.17
 
Any suggestion is highly appreciated.
Thank you in advance.
Have a nice day.
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@tmau , Hope Age from one side is used in visual

 

Calculate(Sumx(Values('V-I'[Age]), [RPT]), filter(all('V-I'),'V-I'[Age] <= Max('V-I'[Age]) ) )

 

or

Calculate(Sumx(Values('V-I'[Age]), [RPT]), filter(all('V-I'[Age]),'V-I'[Age] <= Max('V-I'[Age]) ) )

 

You can also consider the window function

Continue to explore Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
https://medium.com/@amitchandak/power-bi-window-function-3d98a5b0e07f

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@tmau , Hope Age from one side is used in visual

 

Calculate(Sumx(Values('V-I'[Age]), [RPT]), filter(all('V-I'),'V-I'[Age] <= Max('V-I'[Age]) ) )

 

or

Calculate(Sumx(Values('V-I'[Age]), [RPT]), filter(all('V-I'[Age]),'V-I'[Age] <= Max('V-I'[Age]) ) )

 

You can also consider the window function

Continue to explore Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
https://medium.com/@amitchandak/power-bi-window-function-3d98a5b0e07f

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

@amitchandak thank you for your reply, I have tested the solution and it works (gonna mark it as accepted solution).

Age_rpt = Calculate(Sumx(Values('V-I'[Age]), [rpt]), filter(all('V-I'),'V-I'[Age] <= Max('V-I'[Age])))

tmau_1-1717506422101.png

 

One question: if wanna add a parameter (for example, to have a legend in the plot), how should I modify the formula?
I have added "Y" in both tables.

tmau_2-1717506539337.png

The formula is still good, if the "Y" column is not considered:

tmau_3-1717506569300.png

Once I add the "Y" column, the values are not correct anymore:

tmau_4-1717506763132.png

 

I guess it is related to the fact that there is another entity to be considered in the formula.
Thank you in advance.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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