One of the use cases of using parameters as filters is that you can remove null values as one of the options. But there are times when you want to show all values in the filter. You can hardcode and type all the field values that will show up when the parameter selected is ‘All’ but it takes time and you will need heaps of typing.

I did this in my visualisation for Build Up Nepal, a Viz For Social Good community initiative. Do check Viz For Social Good out here if you haven’t heard of it.

 

1) Adding all values from the dataset and ‘(All)’

Here, I selected ‘Add values from’ and added all the year values from the dataset. Then added ‘(All)’ as one of the parameter values manually.

 

Figure 1: Values in the parameter, add (All) as one of the values manually

 

2) Create a calculated field based on the parameter

IF datetime([Parameters].[Peak Impact Year])=[Pivot Year] then TRUE
ELSEIF [Parameters].[Peak Impact Year] = ‘(All)’ then TRUE
ELSE FALSE
END

What this does is that if the values from the dataset come from the year which is the same as what is selected from the parameter, it will be identified as TRUE. There’s another condition also so if the user selected ‘All’, all values the result will be TRUE regardless of the year.

 

3) Use the calculated field as a filter

Drag this calculated field to filter and select TRUE. Now, whenever the condition is TRUE the values will be shown.

If you have any questions, feel free to reach out to me on Twitter or LinkedIn.

Cheers,

Jo

 

Johanna Josodipuro
Author: Johanna Josodipuro

Johanna completed her Master of Commerce degree in Business Analytics and Marketing from the University of Sydney. She was introduced to Tableau during her studies and it wasn't long before she used it to participate in Tableau community initiatives, such as Viz For Social Good. She loves how it enables non-technical audiences to make sense of their data and help guide their decisions. At the same time, it also provides her with an avenue to tap into her analytical and creative side. In her free time, you can find her scrolling through Tableau Public while listening to music and sipping hot tea.