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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Stratifying into 1/3rds Formula

I have around 50 companies and their revenue amounts. I want to create a column or a measure (not sure which would be best) to stratify the revenue amounts into 1/3rds by largest to smallest in revenue. I want the top third (in total revenue amount) to get a risk score of 15, the middle third would get a 10 and the bottom third would get a 5. 

 

 

8 REPLIES 8
v-xuding-msft
Community Support
Community Support

Hi @Anonymous ,

I created a simple sample that you could try and check if it is what you want.

They are all measures.

Cumulated Revenue = 
CALCULATE (
    SUM ( 'Table'[Revenue] ),
    FILTER ( ALL ( 'Table' ), 'Table'[Business] <= MAX ( 'Table'[Business] ) )
)
Cumulated Percentage =
DIVIDE (
    [Cumulated Revenue],
    CALCULATE ( SUM ( 'Table'[Revenue] ), ALL ( 'Table' ) )
)
ABC Class = 
SWITCH (
    TRUE (),
    [Cumulated Percentage] <= 0.33,5,
    [Cumulated Percentage] <= 0.66,10,
   15
)

1.PNG

For more details, Please see the attchment. If I misunderstanding, you could reference the DAX patterns blog to have a try.

ABC Classification 

 

Best Regards,

Xue Ding

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

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

After I made the cumulated Revenue measure I got the following error message:

 

MdxScript(Model) (4,101) Calculation error in measure [Cumulated Revenue}: DAX comparison operations do not support comparing values of type Number with values of type Text.

Hi @Anonymous ,

Have you resolved the problem? If yes, please accept the helpful answer as a solution. And welcome to share your solution. If you still have questions, please share a few screenshots to make us understand clearly.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

In the Query Editor, change the format of the numeric column to Decimal numbers.


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

Hi @Anonymous ,

> DAX comparison operations do not support comparing values of type Number with values of type Text.

Based on the error message, it might be caused by the parentheses. You could use this to format it and check it. And can you please share your formula and the data type of columns? Then we can find the error out.

 

Best Regards,

Xue Ding

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

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Anonymous 

One way is percentile - https://community.powerbi.com/t5/Desktop/Calculating-the-percentile-for-a-set-of-data/td-p/250581

Second is the percent of running total,

Like


measure =
var _1 = divide(calculate(table[revenue],filter(all(table),table[revenue]<=table[revenue])),calculate(table[revenue],all(table)))
return
if(_1<=.33 ,15, if(_1< .66,10,5))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community Champion

Sample data would be great. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Probably use RANKX to get a ranking and then you can segment that into thirds. Diffifult to be more specific.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Below is some sample data. So the file is two columns (Business and Revenue). 

BusinessRevenue
Cubs    344,748
White Sox    193,262
Red Sox      49,997
Padres      45,929
Yankees    155,912
Dodgers      82,667
Mets      79,192
Cardinals      77,123
Braves      74,897
Astros      80,239

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors