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

rankx is not working on negative numbers especially for measures

I applied rankx method for the values that are outcome of a measure which has positive and negative values that doesn't give a proper ranking.

 

 

Balance            rank

 

100                    1

90                      2

70                      3

50                      4

20                      5

-10                    8                   -> It should give a rank 6

-20                    9                   ->  rank 7

 

Any Suggestions?

 

 

 

 

 

2 REPLIES 2
Highlighted
Super User IV
Super User IV

Re: rankx is not working on negative numbers especially for measures

Can you share your formula?

 

Because the following two measures work for me:

 

MyBalance = SUM(Balances[Balance])

Rank = RANKX(ALL(Balances),[Balance],[MyBalance])

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

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!




Highlighted
Helper II
Helper II

Re: rankx is not working on negative numbers especially for measures

It involves a loop of measures

 

RankVolBalByBorough = IF(HASONEVALUE(HFSV_Tracker[Borough]),RANKX(ALLSELECTED(HFSV_Tracker[Borough]),[Selected MeasureVolBal],,,Dense)
)

 

Selected MeasureVolBal = IF(ISFILTERED(HFSV_Tracker[Borough]), [aYTDBorBalanceVol],[aYTDCmdBalanceVol])

 

aYTDBorBalanceVol = sum(HFSV_Tracker[P1_Visit])-sum(HFSV_Tracker[VolumeTargetYTD])

 

aYTDCmdBalanceVol = sum(HFSV_Tracker[P1_Visit])-sum(HFSV_Tracker[RegTargetYTD]) 

 

Based on the selection, it picks up different measure and that measure is passed to Rankx method.

 

 

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.

Community Summit North America

Community Summit North America

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

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors