How to compare a selected value with parameter action.

by Ronaldo Licaj

I decided to write this blog because the topic I am about to engage in has been bugging me ever since I created encountered it. I am talking about, how can someone compare a selected value with parameter actions in Tableau.

Let’s say we have the sub-category that we want to compare the selected value within. The first thing we need to do is to drag the sub-category into rows. Then, we need to create a sub-category parameter and choose the data type as a string and set it to the current value. Next, we need to create a calculated field to set the value for the selected sub-category. We can also drag into the columns field the sum of sales.

Next, we need to create another calculated field in order to be able to calculate the difference between the value for the selected sub-category to that of the sum of sales. The next step is to incorporate a Fixed LOD function in the value for the selected sub-category we created above, and in order to handle any scenario that might return null, we use the ZN function in the same calculated field.

Last, we need to set a parameter action in order to be able to update the already existing sub-category parameter, and set the value to nothing to reset it every time I chose a value. To fix the color, we set a calculated field by giving a string inside called “Dummy”. For our ‘Dummy’ we set a highlight action in order to be in effect by simply choosing our dummy to be highlighted field selected. By dragging the Difference field calculated into the color marks we highlight the difference between the values.

I hope it was constructive for you as well as for me. Thank you.