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

Formula Help

I have used a RANKX formula on a column named Clothes and now I want the top third of the data to get assigned a value of 15, the middle third of the data to be assigned 10, and the bottom third to be given a 5.  How would I do this?

Clothes 

Rank

Pants

4

Hat

7

Shirts

9

Shorts

2

Dress

5

Skirts

8

Socks

6

Jacket

1

Shoes

3
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

Perhaps:

 

 

Column = 
  VAR __break = MAX([Rank])/3
RETURN
  SWITCH(TRUE(),
    [Rank] <= __break,15,
    [Rank] > 2*__break,5,
    10
  )
  

 



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...

View solution in original post

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

Perhaps:

 

 

Column = 
  VAR __break = MAX([Rank])/3
RETURN
  SWITCH(TRUE(),
    [Rank] <= __break,15,
    [Rank] > 2*__break,5,
    10
  )
  

 



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

HI @Greg_Deckler 

 

I am trying to write this formula in my Power Bi Desktop and I am not sure how to do so.  I have never written a formula that looks like this before. 

@Anonymous  - Right-click the table in the Fields area, New Column. Formula bar should appear, copy and paste the code.



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...
parry2k
Super User
Super User

@Anonymous can you post what your expected output should be. Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

I added another column in the table which is labed Risk Score.  This data is just a very small and simple sample data to what I am actually using.  As you can see in the Risk Score column, the top 3 got a Risk Score of 15, the middle 3 got a score of a 10, and the bottom three got a score of 5. I want me full data to have formula where it can stratify the data into thirds and assign it the proper risk score. 

Clothes RankRisk Score
Pants410
Hat75
Shirts95
Shorts215
Dress510
Skirts85
Socks610
Jacket115
Shoes315

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.