Tableau Tip | Dynamic toggle between multiple parameters!
When it comes to tableau, Parameters are so beautifully configured that it can be used anywhere anytime, within same or different data sources with multiple functions assigned. After the introduction of parameter actions the flow becomes so smooth that parameters can be used to trigger other parameters or even trigger itself and the best thing is multiple configuration of parameter action is possible from same parameter from same workbook and even from a single mark in the view.
Even though introduction of parameter actions is a game changer for me and my fellow Tableau developers, there are somethings which I personally felt difficult to achieve, something like dynamically toggle between two or multiple parameters in a dashboard.
Let me explain, Lets say I have a trend view which shows sales trend for the year. I have a parameter which toggle the views aggregation between Month and Quarter. So ideally my next parameter should be a parameter or a filter for selecting any month/quarter from view. There resides my problem! I cannot dynamically toggle between or combine my month and quarter parameter together. Both of the parameters needed to be physically exist in the dashboard even though I need not require them both at the same time.
This is one of the use cases I always encounter from client sides. So I am just sharing a workaround I usually use for these scenarios.
Since I am not a fan of hiding it with a sheet! and its not a practical solution for all scenarios, I am here recommending to create a Fake Parameter for this purpose!
Yes! Fake Parameter! and I promise you will never even feel any difference, if formatted properly, like the image above!
Is that dimension filter toggled with a calculation? Nop its Pure parameter!
This is achieved by a couple of parameters and a bunch of parameter actions. Lets me give a walkthrough!
What you need?
What is the Plan?
We are going to simply combine month and quarter parameters together in a calculation and use that calculation to trigger the corresponding parameter
Calculations
1.Toggle Numbers - is calculation is used to trigger the corresponding parameter
2. Toggle Inverse - Used to toggle value within same parameter
3. Toggle Text - Used in the suggestion sheet to dynamically change suggestion values ie when month is selected in Select view parameter the suggestion will be months and for Quarter selected it will show Quarters
4.Show/Hide - To Hide the suggestion sheet when its not necessary
5. Show/Hide Arrow - Icon for suggestion indicator
Thats all we needed!
Recommended by LinkedIn
The Fake Parameter!
Lets create the sheets required!
1) Suggestion sheet - Just add Toggle Text to rows and text, Add Toggle numbers in detail. Add an additional TRUE and FALSE to the details in order to cancel out the sheet highlighting (remember to add an action at the end)
Add required filters to your view as per your requirements
2) Current Value sheet - Just add toggle text along with a filter for selected date filter (The end goal is just to show what is the current selected value in your parameter. so prepare you calculation based on your requirement)
3) Arrow indicator - Either use the show hide arrow calculation in shape or in label (as unicode arrows are used)
Alas! Done with the sheet.
Now build your dashboard with your required sheets.
Parameter Actions
Not as complicated as it seems. Just add the action to trigger the parameter from each sheet one by one
1) Show/Hide should be triggered from Current value sheet and Indicator sheet -
Target Parameter : Show/Hide Source field : Toggle Inverse
It will dynamically alter values for every selection. So alternatively click the suggestion box will open and close seamlessly
2) Suggestion sheet should trigger respective Month/Quarter parameter
Target Parameter: Month/Quarter Source field: Toggle Numbers
3) And finally suggestion sheet also close the sheet/hide
Target Parameter: Show/Hide Source field : Max(2) (Just add a MAX(2) in adhoc pain of suggestion sheet to trigger this action
And.... Its done!! Format properly and hide the suggestion sheet in the dashboard. All done!
I know this is a long blog! But worth all my time and effort! Attached link for the workbook.
Link: https://bit.ly/3yB1JSZ
Please reach out for any queries and advices. Share if you know any another method for the same scenario.
Regards!
Innovative Visual Analytics Leader providing strategic data driven insight for business optimization
1yGreat post! Thank you for your hack. I'm using some of your technique here with one fake parameter along with an action filter that triggers from sheet A to sheet B. It seems rudimentary to set dynamic default choices for parameters, sets and filters without using parameter actions, filter actions or set actions.
Tableau Engineer, BI Analyst, #Tableau #SQL
1yThank you for sharing
Senior Data Analyst @ ADEK | Tableau, Certified Data Analyst | SQL | Python
2yGreat trick 👑