February 24, 2021 at 7:10 am #25945jhonParticipant@richards12
Hi, I want to know What is the Rank Function in TableauMarch 2, 2021 at 8:03 am #25973mindmajixParticipant@mindmajix
Rank function as the name suggests is used to give the rank to any measure (number related) present in the data set. Now, let’s go step by step and see how to use the rank function in tableau.
1. Open Tableau and we will be able to see the below screen. Connect to a file or server (based on where you input data is present) using the connect option present on the left side of the Tableau landing page.
2. For this article, we are going to use the “Sample- Superstore” data store present and the below screenshot will tell us how the data looks like.
3. Click on the option “Sheet 1” present on the bottom left corner and we will be able to see a window like shown below and this is where we prepare our dashboards.
4. Choose the measure on which we want to apply rank function, here I am going to apply a rank function on Sales measure by taking Region present in dimension as rows. Drag Region dimension to row and drag Sales measure into the marks card .
5. To give rank to the sales measure, we have to create a new calculated field first and we do it by giving a right-click on the sales in measures pane. And we can see a new menu appeared like the screenshot here. Now we have to go to create and then click on the calculated field option present here.
6. After clicking on the calculated field, one new window will pop up and in there we can see that “All” is selected in the drop-down present to the right.
7. As mentioned earlier, rank functions will be in table calculations so we have to open the drop-down and select “Table Calculations” and we will be able to see all the rank functions and little information about the functions.
8. As we want the rank function to be applied on the aggregate of sales measure, the calculation will be “Rank(Sum([Sales]))” and we can give the name to this calculation. Here in this example, I am going to name the calculation as Rank.
9. After giving the calculation, we will go ahead and click on Apply and Ok for this calculation to reflect in the Measures section. After we see Rank in the Measures pane we should drag it onto the aggregate of sales present in the dashboard area
10. Here, in the marks pane both aggregate of sales is set to “details”, to have a better understanding let us change it to “Text” to do this we just have to click on the symbol on the right of measure in marks card and it will open a window with “Text” as one of the options, select it
11. So, after this is done from the values provided we can see that the highest rank (1) is given to the region with the highest value of sales ($725,458). If we want to rank to be shown in a separate column, then change the order of steps by doing Step-10 first and then move on to Step-9.
12. If we want to do any changes in the formatting, we have to click on the drop-down present to the left on the Rank section in the Measure values pane and here we can do all the changes in format (Axis and Pane formats).
13. Here we are having all different values and If there is the same value who will be given the better rank? Different users have different requirements to solve this tableau provides us with a few more additional features Rank Dense, Rank Unique and Rank Modified. And also tableau by default picks some properties and one of them is sorting in Descending order.
- You must be logged in to reply to this topic.