cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

DAX, RankX, rank 0 first, follow by descending

Hi, 

 

Need help to write a DAX such that "0" is always rank 1st, follow by descending order in numerical sequence. Thanks. 

 

Required:

DAX: ???

Required Sequence: 0, 20, 12, 7

 

Current:

DAX: PRT2_RankDefect = RANKX(ALL(data[DefectID]),[PRT0_Total])

Sequence: 20, 12, 7, 0

 

2017-06-05 22_43_35-Start.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: DAX, RankX, rank 0 first, follow by descending

Rank = IF([Value]=0,1,RANKX(Ranking,Ranking[Value],Ranking[Value],DESC)+1)

---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
Highlighted
Super User IV
Super User IV

Re: DAX, RankX, rank 0 first, follow by descending

Rank = IF([Value]=0,1,RANKX(Ranking,Ranking[Value],Ranking[Value],DESC)+1)

---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors