7 Replies Latest reply on Jun 22, 2018 6:55 AM by Junhao Li

# Count of Ranks

The goal is building a histogram of count of ranks. Basically, I want to see how many city is in rank no.1, rank no.2, etc.

The answer is obvious since every state has one city in rank no.1. However, I just want to show the histogram for this workbook.

• ###### 1. Re: Count of Ranks

Hi Junhao,

Apologies I do not have time to open your chart right now, but, you could use a window_count() function with your rank expression. Being aggregated with a table calc, your options are now quite limited but window_ functions are themselves table calcs so you can table calc a table calc.

Steve

• ###### 2. Re: Count of Ranks

I don't know if the window_functions will work, at least I didn't find a way yet. I am thinking about the bins function.

If you have a chance, please look at the workbook.

• ###### 3. Re: Count of Ranks

This is what I am trying to build.

• ###### 4. Re: Count of Ranks

Hi Junhao,

This is a difficult one:

I have created the rank as a parameter first to show how easy it is to apply to differing measures.

1. Beginning with a table of the dimensions you need to be ranking over, add the sum of the measure and then the rank so you are able to see that the rank is working properly - I have scoped the rank to calculate over 'City'.

*Note* The Rank has been created as a string in order to convert to a discrete measure; this allows for later plotting

2. Move the State to the detail field - this will begin to explode the data-marks out as Tableau begins to dis-aggregate the data, although you should still find that the cities have maintained their rank.

3. Using a Minimum Number of Records - Minimum as you are only interested in counting the numbers of records that are grouped by the rank, plot this onto the rows to provide the numbers of records that meet the ranking criteria.

4. Finally, in order to remove the individual records that make-up each bar, drag the same Min. Number of records onto the colour to give the impression of a solid bar.

Steve

• ###### 5. Re: Count of Ranks

It is really well done. Thank you so much!

I don't know if you have time to look at my another question about rank. If you do, that will be perfect!

• ###### 6. Re: Count of Ranks

Glad this helped, I shall take a look at your other question when I get a moment

Steve

• ###### 7. Re: Count of Ranks

Going back to your solutions. It works great!

But would you mind going one step further and help me with one more question?

Is it possible that you can put two different dates of data on the same graph? For example, using Ship Date, I want to see a comparison of count of ranks for two ranges of date. Like 1/1/2017 to 6/30/2017 compared with  7/1/2017 to 12/31/2017.