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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Syndicate_Admin
Administrator
Administrator

Add percentages up to a value

Good afternoon

I need to classify a column (contracts) that accumulate 80% of the sale. The table below shows all the contracts with their imports and the % of the total.

I want to put together a measure that the first contracts that add up to 80% are classified as A, and that the remaining 20 are B. There can be two measures as well.

How can I put together a measure or what do you recommend doing?

jjgamenara_0-1701193994384.png

Thank you.

2 ACCEPTED SOLUTIONS
Ritaf1983
Super User
Super User

Hi @Syndicate_Admin 
Take a look at the linked tutorial, it seems like the same scenario with a little modifying according to your needs.

https://www.youtube.com/watch?v=jCK-RUMggkM

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Anonymous
Not applicable

Hi @jjgamenara 

Please try:

 

ABC Class Optimized = 
VAR SalesByProduct = ADDCOLUMNS (ALL('Table'[ID]), "@Sales", [Total Sales] )
VAR CurrentSales = [Total Sales]
VAR BetterProducts = FILTER ( SalesByProduct, [@Sales] >= CurrentSales )
VAR CumulatedSales = SUMX ( BetterProducts, [@Sales] )
VAR AllSales = CALCULATE ( [Total Sales], ALL ( 'Table'[ID] ) )
VAR CumulatedPct = DIVIDE ( CumulatedSales, AllSales )
VAR AbcClass = IF(CumulatedPct <= 0.8, "A","B")
RETURN
   AbcClass

 

Output:

vcgaomsft_0-1701397515337.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


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

Hi @jjgamenara 

Please try:

 

ABC Class Optimized = 
VAR SalesByProduct = ADDCOLUMNS (ALL('Table'[ID]), "@Sales", [Total Sales] )
VAR CurrentSales = [Total Sales]
VAR BetterProducts = FILTER ( SalesByProduct, [@Sales] >= CurrentSales )
VAR CumulatedSales = SUMX ( BetterProducts, [@Sales] )
VAR AllSales = CALCULATE ( [Total Sales], ALL ( 'Table'[ID] ) )
VAR CumulatedPct = DIVIDE ( CumulatedSales, AllSales )
VAR AbcClass = IF(CumulatedPct <= 0.8, "A","B")
RETURN
   AbcClass

 

Output:

vcgaomsft_0-1701397515337.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Ritaf1983
Super User
Super User

Hi @Syndicate_Admin 
Take a look at the linked tutorial, it seems like the same scenario with a little modifying according to your needs.

https://www.youtube.com/watch?v=jCK-RUMggkM

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.