cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
codyraptor Regular Visitor
Regular Visitor

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

Accepted Solutions
codyraptor Regular Visitor
Regular Visitor

Re: Ranking giving bad results

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])))

8 REPLIES 8
v-micsh-msft New Contributor
New Contributor

Re: Ranking giving bad results

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

 

codyraptor Regular Visitor
Regular Visitor

Re: Ranking giving bad results

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.

v-micsh-msft New Contributor
New Contributor

Re: Ranking giving bad results

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

 

codyraptor Regular Visitor
Regular Visitor

Re: Ranking giving bad results

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?

codyraptor Regular Visitor
Regular Visitor

Re: Ranking giving bad results

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.

v-micsh-msft New Contributor
New Contributor

Re: Ranking giving bad results

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

codyraptor Regular Visitor
Regular Visitor

Re: Ranking giving bad results

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])))

Highlighted
v-micsh-msft New Contributor
New Contributor

Re: Ranking giving bad results

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
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Users Online
Currently online: 170 members 2,551 guests
Please welcome our newest community members: