Filtering the Dimension But maintain the Rank per Sales
Share
If you are new to the Tableau or you are from a different background and want to shifft to analytics and also would like to know who can learn Tableau and why should you learn tableau read my blog – Who , Why, Where Should You Go For Tableau Training
We all know that working with Table Calculation in Tableau can be tricking, but again it is one of the beautiful features of Tableau that can make our most complex analysis easy. So, here I have one such scenario to present.
Scenario: During my corporate trainings, I have been showing a use case where you can filter out the dimensions according to their ranking as per sales, Like below:
But, recently I got a requirement from one of my clients that the user should get the filtering option on the dimension and not on the ranks. That means if we see the image above the user has got the filter option on the Rank.
But the client wanted something like below image:
As you can see, the filtering option is on Sub-Category.
Issue: The Issue with this is that because there is a Table Calculation of RANK on the sheet, we want to maintain the Rank irrespective on the filter. So, what I want is that if I filter the Art it should be filtered out with its Rank. But what actually is happening is that when we filter out Art its Rank is being replaced by the next Sub-Category.
So, if we do it in the normal way, that is just by Ranking and then adding the Sub-Category in the filter shelf then we filtered out ART. ART was 14th rank, so vizql have the 14th rank to ENVELOPES which was originally the 15th. Then when I filtered ENVELOPES then 14th rank was given to LABELS. So, as we go on filtering the Sub-Category the RANK is CHANGING. We want the RANKS to be MAINTAINED even after FILTER.
This happens because everything recalculates on the basis of what is in the view. Sub Category filter is dimension filter which takes place before the Table Calculation.
Step-1:
This time we create a RANK CF to give the Rank to the various Sub Categories on Sales. We change it to DISCRETE and edit the table calculation to SPECIFIC DIMENSION and bring it to rows.
Stpe-2:
We create another CF RANK FILTER which will be a window_max of attributed Sub-Category. we put this in the Filter shelf and select whatever values we get. Then we change this RANK FILTER TC to Compute using cell. Once done this the values will stick to their cell or their SC. Now, when you filter the viz on the SC the Ranks will stick to it. As we can see in the below image Rank 1, 14 & 15 are missing, because Phones, Art & Envelopes are filtered out from the viz.
Step-3:
Now, to take this a step ahead we want to give the user the right to Select the dimension, see its ranking and then Filter out the dimension that they want to; maintain the RANK. So, we create a parameter Select a Dimension and a CF Dimension Selector for Rank so that we can select the multiple dimensions (Segment/ SC/ Category/ Region). we replace the Sub-Category on the row shelf with SELECT A DIMENSION FOR RANK field. and we see that the parameter is working but THE FILTER IS ONLY WORKING FOR SUB-CATEGORY AND NOT FOR OTHER DIMENSIONS.
See below the image when client selects Sub-Category:
See below the image when client selects another Sub-Category:
Step- 4:
Please note here that your ranking will be working correct even if the Rank TC which is in rows is Compute using Table Down.
But to make the filter work the Rank field on the filter shelf should be on SPECIFIC DIMENSION option in the edit table calculation shelf and the
Rank Filter filed should be edited to:
Window_Max(ATTR(Dimension Selector for Rank)
The Final Viz:
For Corporate training and Online Training contact at info@instrovate.com or call / whatsapp at +91 74289 52788
If you are new to the Tableau or you are from a different background and want to shifft to analytics and also would like to know who can learn Tableau and why should you learn tableau read my blog – Who , Why, Where Should You Go For Tableau Training