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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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

@Anonymous , 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

@Anonymous , 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])))

Anonymous
Not applicable

Thanks for your prompt reply! that works perfectly

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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