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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
codyraptor
Resolver I
Resolver I

Ranking giving bad results

I'm sure I'm missing something simple, but the Rank function is giving me a tie when the data clearly shows that there isn't a tie.  Any help is greatly appreciated!!  Below is the formula and a screenshot of the output.   

 

Rank = rankx(ALLSELECTED(Vendor[Vendor]),[Total Recall])

 

Total Recall is a measure.

Rank.PNG

 

1 ACCEPTED SOLUTION

I believe I might have figured it out.  The following calculation allows me to add the specific items to my visualization without destroying the initial rank.

 

Rank Recalls = RANKX(ALLSELECTED(Market[Market ID]),CALCULATE([Total Recall],ALLSELECTED(Market[Rep]),ALLSELECTED(Market[Manager])))

View solution in original post

8 REPLIES 8
v-micsh-msft
Employee
Employee

Hi codyraptor,

 

Only with the formula and the Visual, I can't say which part has impact on the Rankx result. If you could share some data sample, it would be greate for us to offer a suggestion.

In addition, take a try to change the formula with the format below:

[Rank] :=

  IF(HASONEVALUE(Vendor[Vendor]),
     RANKX(ALLSELECTED(Vendor[Vendor]),
 [Total Recall]),
     BLANK()
    )

Besides, check the blog below regarding different scenarios regarding Rankx function, see if it would help here:

Rankx Scenarios

Please post back if you need any further assistance.

Regards

 

Rank = if(HASONEVALUE(Vendor[VENDOR_ID]),RANKX(ALLSELECTED(Vendor[VENDOR_ID]),[Total Recall]),BLANK())

 

This formula seems to work if I only look at "VENDOR_ID" and "RANK" in a table or matrix..etc..

 

But if I add "Vendor Name" or "State"...any other possible slice to show more info..then rank is no longer valid.  Is there a way to make it dynamic so if I add another piece of data to it..it won't cause an issue.

 

Ultimately..I would like to have "Rep, Market, Vendor Name, and Rank" in one visual.

Hi codyraptor,

How about change the formula into the following one?

Rank = RANKX(ALLSELECTED(Vendor),[Total Recall])

Are "Rep, Market, Vendor Name" all columns, and in one table?

By the way, would it be available for you to share some data samples, so that we could test the formula?

Regards

 

Rep and Market are in one table...vendor name is in another one...Trade is in another one...and total recall is in another one.  They're all joined by different keys.

 

My hope is to say....Rank Total Recall...by market and show the rep assigned to that market.  I can share some test data...am I able to paste a file on this?

It's almost like it will only allow a rank of one item...so I can rank by Rep..or I can rank by Market..etc...   But if I have it ranking Market..and then just add the rep's name to the visualization...then it blows up.

Hi codyraptor,

You could upload the test data into OneDrive or other shared online Drive, then copy and paste the shared link here.

We will take a look at the sample and see what we could suggest.

Regards

I believe I might have figured it out.  The following calculation allows me to add the specific items to my visualization without destroying the initial rank.

 

Rank Recalls = RANKX(ALLSELECTED(Market[Market ID]),CALCULATE([Total Recall],ALLSELECTED(Market[Rep]),ALLSELECTED(Market[Manager])))

Hi codyraptor,

 

Thanks for the update.

If you need any further assistance on this topic, please feel free to post back.

Regards

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.