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 percentage of purchases to suppliers

Hello,

 

I want to find the cumulative percentage of the purchases made to suppliers.

 

I have a measure that calculates the total purchases by supplier :

 

Product Purchases = SUMX(VALUES('All'[Nom fournisseur]),CALCULATE(SUM('All'[Valeur CHF])))
 
And I tried to calculate the cumulative percentage :
 
Cumulative Percentage =
var sales=CALCULATE(SUM('All'[Valeur CHF]),FILTER(ALLSELECTED('All'[Nom fournisseur]),ISONORAFTER('All'[Nom fournisseur],MAX('All'[Nom fournisseur]),DESC)))
var totalsales=CALCULATE(SUM('All'[Valeur CHF]),ALLSELECTED('All'))
return DIVIDE(sales,totalsales)
 

However, with this way of doing things, the cumulation is done by the alphabetic supplier name and not by the total amount of purchases.

 

Picture1.png

 

Can you please help me to make the cumulation by the total amount of purchases by supplier ?

 

Thank you in advance.

 

AlBers

1 ACCEPTED SOLUTION

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

View solution in original post

12 REPLIES 12
amitchandak
Super User
Super User

You can cumulative by the supplier or by time. Not very clear what you want

for time you could have done like Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,date[date])))

Anonymous
Not applicable

Thank you for your answer @amitchandak  !

 

I want to cumulate by the column (measure) Product Purchases.

 

But since it's a measure, I cannot use the MAX() function as you say...

hi  @Anonymous 

Just adjust the formula as below:

Cumulative Percentage = 
var sales=CALCULATE(SUM('All'[Valeur CHF]),FILTER(ALLSELECTED('All'),'All'[Valeur CHF]<=SUM('All'[Valeur CHF])))
var totalsales=CALCULATE(SUM('All'[Valeur CHF]),ALLSELECTED('All'))
return
DIVIDE(sales,totalsales)

 

Regards,

Lin

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

Hello @v-lili6-msft,

 

Thank you for your answer.

 

But your formula gives me the following case:

 

Picture1.png

 

It seems like the cumulation is made in the wrong direction and that the percentage is wrongly calculated ...

hi  @Anonymous 

If so, just adjust the formula as below:

Cumulative Percentage = 
var sales=CALCULATE(SUM('All'[Valeur CHF]),FILTER(ALLSELECTED('All'),'All'[Valeur CHF]>=SUM('All'[Valeur CHF])))
var totalsales=CALCULATE(SUM('All'[Valeur CHF]),ALLSELECTED('All'))
return
DIVIDE(sales,totalsales)

 

Regards,

Lin

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

Hello @v-lili6-msft,

 

It still doesn't work ("Cumulative Percentage 2") ...

 

Picture1.png

 

Maybe we have to use a measure like this one :

 

Product Purchases = SUMX(VALUES('All'[Nom fournisseur]),CALCULATE(SUM('All'[Valeur CHF])))

 

Used to calculate the sum of purchases values by supplier.

 

Thanks a lot ! Best regards !

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/
Anonymous
Not applicable

Hello @Ashish_Mathur and @v-lili6-msft,

 

Thank you for your answers !

 

Here is the sample pbix file : https://we.tl/t-lmOY1iuUBz

 

The two actual solutions give a wrong result ...

 

Best regards 

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

Nice !!!

 

Thank you so much @Ashish_Mathur !!!

 

Have a nice afternoon, best regards.

You are welcome.  If my reply helped, please mark it as Answer.


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

hi  @Anonymous 

If possible, could you please share your sample pbix file for us have a test? that will be a great help.

 

Regards,

Lin

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

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.