Highlighting a measure column from many in Tableau
Recently, I was asked to highlight one measure out of a few measure columns in a text table using Tableau. And the user should have the facility to select the measure that needs to be highlighted. A casual search on the Net and I discovered a solution which needed a little modification. So, here I will detail the steps I took with respect to the text table and something in line with highlight tables.
For this, we will be using the SuperStore Dataset that comes along with Tableau.
First, decide the measures you want to highlight. Here, we will use Market as Dimensions and Sales, Profit, Discount, and Profit Ratio as measures. We will create four calculated fields — Sales Col, Profit Col, Profit Ratio Col and Discount Col. Each of these calculated fields will contain just 0 <Refer Fig 1>.
Now place these four calculated fields in the Columns toolbar. You will see 0 in the axis of each. Place Sales, Profit, Profit Ratio and Discount measure in the Label Marks Card of each column<Refer Fig 2>.
Bring the alignment of the text to the center via Label Marks card and remove the 0 from the axis. You can do this by right-clicking and selecting the edit axis. In the sub-menu “Tick marks”, select None as Major Tick Marks. Also edit the axis name. Do a little bit of cleaning up like removing the Grid lines, Zero lines, unwanted border lines and bands.
In the Marks card of each measure, select Text from the dropdown, instead of Automatic. This step may help us get rid of the centre line. Based on my experience with this centre line, my suggestion is that try all sorts of cleaning up, as mentioned above. One or the other step will definitely work.
Now, create a parameter. Name it “Highlight Measure Fields”. This will allow the used to select the measure that needs to be highlighted <Refer Fig 3>.
Create four more calculated fields for each measure to manage the color and highlight the measure, selected in the parameter <Refer Fig 4>.
Here, I have named them as Color for Sales, Color for Profit, Color for Profit Ratio and Color for Discount. Place them in the Color Marks card for each of the respective measures. Now the real adjustment starts <Refer Fig 5>.
Setting the Color
The dataset has 5 markets (dimension field). However in Fig 5, you will notice that I have set Stepped Color as 6 and the Start field does not contain the lowest value. We will discuss the reason for that later but first I will detail the steps taken further. For reference, the HTML code for the green used here is #006b00.
What I decided to do was take the difference between the highest and lowest value of that measure and this difference was then divided by five as there are five markets. The outcome was deducted from the lowest figure and then placed as the start figure.
Then, one can wonder if there is a need to go through so much trouble. Yes, reason being, when one measure is highlighted then the rest of the measures should have a color which is not included in the highlighted one (in this case light grey).
By now, few concerns must have started popping up in your mind. I’ll cover 2 here.
1. This method will probably work only with static dataset and not with live dataset. One of the probable solutions is to set the Start as the number which will form as alert for the client. And don’t stick to this way, tweak the figures until you get the desired result. Also, if you have another suggestion, please mention in the comment section so that anybody reading can benefit from your proposition.
2. The other concern is that the light grey color is making the text difficult to read when it is not highlighted. So, change to something on the lines of a highlight table. For this, simply change from Text to Square in the dropdown in the All Marks card. Refer to the image above the title. You can also view an example here.
With this, I’m finished with the improved version to this topic’s solution with the hope that Tableau will soon provide a way to dynamically change the start value in the Edit Color dialogue box.