1
votes

I am using working on Tableau stacked bar chart. The bar chart represents the total %. Therefore, the length of bar chart is equal. Now I would like to sort the dimension (referee) based on the values of legends ( highest to lowest). can anyone suggest me how to do it. I also attached the packaged workfile here Please see the picture here

Here is the picture of sort screen; Sort Screen

Level of data source below: Level of data Below is the screen shot based on the final answer provided: Final Look

Thanks,

Zep

3

3 Answers

0
votes

So to get this you first need to get a calc field that gets the win %:

SUM(IF [FTR] = 'AWins' OR [FTR] = 'Hwins' THEN 1 END)/COUNTD([Game ID])

This can then be used to rank the referees:

enter image description here

Now the reason that it may not be working for you with your technique is that you're sorting on COUNTD(Wins) which is the total number of wins, not the percentage wins for the ref. So someone that has just played more games may come up higher in the rank

Now you have the calc field, you can go back to your report and sort on the new field:

enter image description here

I rearranged the legend so you can see that the ref with the best % wins are shown first (red and blue bars)


If you don't want it sorted by win %, then change the calc field to:

SUM(IF [FTR] = 'AWins' OR [FTR] = 'Hwins' THEN 1 END)

For the COUNTD of games, if you only have the date and the game available and want to create an ID from that that is unique, create a calc field like this:

game-date-id = STR([game]) + STR(' ') + STR(date)

This will then be used in your COUNTD if statement:

SUM(IF [FTR] = 'AWins' OR [FTR] = 'Hwins' THEN 1 END)/COUNTD([game-date-id])
0
votes

here is the pic I have attached the picture of the dashboard. I want to sort the referee based of Hwin

0
votes

Yeah. It did not work out as expected