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

cumulative percentages

Hi!

 

I need to calculate the cumulative percentage as in the file attached.

 

What I need is to have another column with cumulative percentage with 25%, 62,5%, 87.5%, 100%.

 

Any idea how to do it? I checked this thread but couldn't make it.

 

Thanks

 

Cheers,

Andrea

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi great_AS,

See this image and tell us if works for you.

 

test.JPG

View solution in original post

v-danhe-msft
Employee
Employee

Hi @Anonymous,

You could refer to Miltinho's solution, see below code:

Measure = 
var sales=CALCULATE(SUM('TEST'[Sales]),FILTER(ALLSELECTED(TEST[Collection]),ISONORAFTER('TEST'[Collection],MAX('TEST'[Collection]),DESC)))
var totalsales=CALCULATE(SUM('TEST'[Sales]),ALLSELECTED(TEST))
return DIVIDE(sales,totalsales)

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

 

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

17 REPLIES 17
Maldarraji
Frequent Visitor

Hi All can any one help to calculate cumulative for (allocation_rat) column ?

Maldarraji_0-1619507279276.png

 

Hi,

You should have a Calendar Table with a relationship (Many to One and Single) from the Allocation_date column of the Data Table to the Date column of the Calendar Table.  From your visual, remove the Allocation_date column and drag the Date column from the Calendar Table.  Assuming allocated_rate is a measure, write this measure and drag it it your visual

YTD allocate_rate = calculate([allocated_rate],datesytd(calendar[date],"31/12"))

The YTD calculation will restart on January 1 of every year.

Hope this helps.


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

Hi Mr. Ashish, I'm a new intern at The PowerBI, and I don't know how to get the Cumulative when I worked the Calender they give me error. could you please help to create table have cumulative rate starting from 01/01/2015  to 30/12/2021  

Maldarraji_0-1619680750812.png

 

Maldarraji_1-1619681220941.png

any equation that can be applied to get such a result in the yellow color?

Hi,

Share the link from where i can download your PBI file.


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

Sorry but the PBI file in my laptop.Do you want me send you the file

Upload the file to Google Drive and share the download link of the file here.


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

Access Denied message.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-danhe-msft
Employee
Employee

Hi @Anonymous,

You could refer to Miltinho's solution, see below code:

Measure = 
var sales=CALCULATE(SUM('TEST'[Sales]),FILTER(ALLSELECTED(TEST[Collection]),ISONORAFTER('TEST'[Collection],MAX('TEST'[Collection]),DESC)))
var totalsales=CALCULATE(SUM('TEST'[Sales]),ALLSELECTED(TEST))
return DIVIDE(sales,totalsales)

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

 

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AliceW
Impactful Individual
Impactful Individual

Can confirm it still works and it's still needed! 🙂 Thanks, man!

Ashish_Mathur
Super User
Super User

Hi,

 

To compute the cumulative %, how does one know the order to be followed.  Looking at your data, the order is definitely not the Sales.  Is the order the Collection column - Autumn, Spring, Summer and then Winter?

 

Please clarify.


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

HI @Ashish_Mathur, exactly, the order is the collection.

Hi,

 

Here's what i did.  I first wrote this calculated column formula to get the indexing by season

 

Order of seasons = if([Collection]="Autumn",1,if([Collection]="Spring",2,if([Collection]="Summer",3,4)))

 

I then wrote these measures

 

Revenue = SUM(TEST[Sales])
Season order = if(HASONEVALUE(TEST[Collection]),SUM(TEST[Order of seasons]),BLANK())
Cumulative revenue = SUMX(TOPN([Season order],CALCULATETABLE(VALUES(TEST[Collection]),ALL(TEST[Collection])),[Season order],ASC),[Revenue])
Total revenue = CALCULATE([Revenue],ALL(TEST[Collection]))
Cumulative revenue/Total revenue = [Cumulative revenue]/[Total revenue]
 
In the visual. i dragged Revenue and Cumulative revenue/Total revenue.
 
Hope this helps.
 
Untitled.png

 


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

Hi great_AS,

See this image and tell us if works for you.

 

test.JPG

Anonymous
Not applicable

HI @Anonymous!

 

That's perfect!! Can you please share your formula here so I can copy and paste it?

 

Thanks.

 

Cheers,

Andrea

 

Anonymous
Not applicable

Andrea, I solved it then I deleted it.

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.