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
Dunner2020
Post Prodigy
Post Prodigy

Rankx based on table column

Hi there,

 

I have data which looks like the following:

 

IDNo of Customer
AX1681081
FH53081046
CH2008551
FK77841336
WK27521456
QT5202390
AT7642525
AB4543
AT7692347
WK2755620
AX162607
CM822725
PC3500
EK480461
OT2305
ET5635
CH2006842
LF6576198
MG6443

 

Now I want to create a measure which ranks based on the number of customers column. I wrote a code something like that:

 

Rank by Customer = RankX(ALL(Table),Table['No of Customer'],,DESC)

 

I know that Table['No of Customer'] is the wrong argument and it should be replaced by expression. However, did not know what the replacement should be? Could anyone help me in that?

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@Dunner2020 - See this article - https://community.powerbi.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1042520#M452



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

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@Dunner2020 - See this article - https://community.powerbi.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1042520#M452



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

@Greg_Deckler , I followed the article and changed my code to the following:

 

ICP Rank = RANKX( ALL('Table'),[ICP],,DESC)
 
But it still gave me an error that 'The value for ICP cannot be determined. Either the column does not exist, or there is no current row for this column'.
 
 

@Dunner2020 , Are trying Column Rank (Static) or measure Rank( Dynamic and Context sensitive.

 

New column

ICP Rank = RANKX( ALL('Table'),[ICP],,DESC)

 

New Measure

ICP Rank = RANKX( ALL('Table'),Calculate(Sum([ICP])),,DESC)

 

or

ICP Rank = RANKX( ALL('Table'[Customer]),Calculate(Sum([ICP])),,DESC)

ICP Rank = RANKX( ALLSELECTED('Table'[Customer]),Calculate(Sum([ICP])),,DESC)

 

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...

 

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

@Dunner2020 - You need an aggregator around it like SUM, MAX, etc.



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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.