cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
zhengho
New Member

How to calculate a correct cumulative percentage

Hi, 

In my raw data (group by Year, Vintage and Age), I have two columns called 'total cash' and 'total purchase balance' and I have a measure called 'total payment %' = sum(total cash)/sum(total purchase balance). Below is an example to show the "total payment %"

Orig YearVintageage0age1age2age3
2023Jan, 20235.85%18.21%14.12%11.22%
 Feb, 20235.78%19.65%13.27% 
 Mar, 20236.76%17.05%  

for the next step, I want to calcualte cumulative total payment % so that the results look like below table

Orig YearVintage0123
2023Jan, 20235.85%5.85%+18.21%=24.06%24.06%+14.12%=38.18%38.18%+11.22%=49.4%
 Feb, 20235.78%5.78%+19.65%=25.43%25.43%+13.27%=38.7% 
 Mar, 20236.76%6.76%+17.05%=23.81%  

However, when I use quick measure 'running total' to calculate 'total payment%' over age, I got wrong number:

zhengho_0-1686169969344.png

 

It seems like the measure calculates number based on running sum 'total cash' and sum 'total purchase balance' first and then make the division rather than calculate percentage first and then running sum the percentage:

for example:

if total payment % (Age1) = 10/100=10%, total payment % (age2) = 12/120=10%

my expected cumulative total payment % for age 2 shoud be 10%+10% = 20%

but Power BI return me (10+12)/(100+120)=10%.

 

Any Idea will be really helpful! thanks a lot

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@zhengho , Assume you already have a measure total payment %

 

Cumm Sales = CALCULATE(Sumx(Values('Date'[Month Year]), [total payment %]),filter(all('Date'),'Date'[date] <=max('Date'[date])))

 

or

 

 

 

Cumm = CALCULATE(Sumx(values('Date'[Month Year]),[total payment %]) ,filter(allselected('Date'),'Date'[date] <=max('Date'[date])))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@zhengho , Assume you already have a measure total payment %

 

Cumm Sales = CALCULATE(Sumx(Values('Date'[Month Year]), [total payment %]),filter(all('Date'),'Date'[date] <=max('Date'[date])))

 

or

 

 

 

Cumm = CALCULATE(Sumx(values('Date'[Month Year]),[total payment %]) ,filter(allselected('Date'),'Date'[date] <=max('Date'[date])))

Thanks for your prompt reply! that works perfectly

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors