Monday, March 9, 2020

Parameters and Parameter Actions

My blog has moved to jimdehner.com 

Thank you for all the support over the past 2 years - I recently updated my blog to make it easier to read, improve the rendering of images and tie back to video presentations that are associated with the content - Check it out at  Jim's new blog  -   


Do you use parameters - I love them and use them a lot - Let's look at them in more detail

Parameters are one way users can directly input a value into Tableau.  

They are:

  • Single valued –  have one value at a time 
  • Static the value is constant until manually changed by the user 
  • Global – they are available for use throughout the workbook. 

But they don’t do anything until they are used in a calculation, a set, or a filter.  

The same parameter can be used in any mix of calculations or filters on a single any combination of worksheets or dashboards.  Changing the value of the parameter will change the calculation or filter wherever it is used.  The change takes places as the sheet is opened.


There are 3 steps to follow when using parameter

  • Create it
  • Put it in the viz
  • Use it in a calculation or filter

1-Create it

Parameters can be created directly from the data





Or from the Filter or Set Top N  tabs








Select Create Parameter - when the window opens  set up the parameter
  • Add a meaningful name that tells the user what to do
  • Select a data type that matches that of the dimension you will use
  • Load values into the parameter either typing directly or from the dimension
  • Click OK and you are done




2 Add the parameter to the viz


All you need to do is open the parameter pill and select Show Parameter Control







3-Use it in a calculation or a filter

After creating the parameter you need to use it - it is the calculation or the filter that affects the data in the viz - not the parameter by itself. 

Example 1 - Parameter driven T/F filter

The easiest way to use the parameter is in a True/False filter - the expression just says when the subcategory is equal to the one the user selected using the parameter return a True




Placed on the filter shelf and set to True will return this



Example 2 - Use it in a Set

The same parameter can be used to create a set - The Formula area on the Condition tab acts like an LOD -aggregate the dimension using Max or Min (sorry no Attr()) - set the Max subcategory to the parameter value to select the "In" value - all others are in the "Out"


a possible viz could compare the selected subcategory to all others





Example 3 - Change all views in a dashboard

Parameters are global - when the value is changed it changes all the calculations or filters where the parameter is used -

Bring the 2 worksheets together on a dashboard and changing the parameter value will affect both sheets without using filters or actions





Example 4 Top N filtering

Parameters can also take on numeric values like in the following Top N example 

Create a filter on Subcategory and open the Top tab 
Select Create From Parameter




When the window opens - select a starting value and a range




and create a viz 



The user can set the N from the control on the left - Note also the subcategory drop down will list all subcategories and has a reference to the Top N filter application 

Example 5 - Parameter Actions

With the 2019.2 release Parameter Actions were introduced given the user an easy visual way to change parameter values for the viz without opening a drop down - 

I will replace the parameter drop down from the earlier example with a value picker - a simple worksheet with the values (here subcategory names and a circle mark)   A horizontal will work well the the overall layout of the dashboard




Add the value picker to the dashboard and create a Parameter Action -

  • From the Dashboard on the upper ribbon select Action
  • Then Add - Change Parameter
  • Give the action a name
  • The source is - Value Picker 
  • The target is  Select Subcategory parameter


I used Hover for the example you can select what works best in your analysis






The value of the parameter and the viz will change as the user  hovers order the Value Picker marks - see the video




Have some fun with Parameter Actions -They are major enhancement  for the user experience

Example 6 Dynamic Parameters

Now the game changer - Dynamic Parameters - introduced with the 2020.1 release the parameter value list can be updated when the date source is updated and the workbook is opened - see how they work in the simple example below

In this example sales data is updated weekly - the initial load includes 4 dates 4/13-18 - the user wants to use a parameter to filter by individual date  - the viz looks something like this:






The dynamic parameter set up adds only a couple fields to the one you have used so far


  • the parameter that is to be updated and the field in the data set
  • initial value of the parameter (default is Current) 



In the example I added an LOD for the fixed max date in the data set - the parameter value will update to the latest date in the data set





When you update the data and when you reopen the book the parameter updates




NOTE - UPDATE     the 2020.3 release now will update the parameter and from a data source refresh or edit  - If you are on an earlier version see below

Desktop users - Note if working from a live data source and manually refresh the source you will need to close and reopen the Tableau workbook before the parameter updates

I hope this helps you understand parameters, parameter actions and dynamic parameters better  - I love using them - with a little practice you can too

The workbook examples used in the first part of this post can be found on my Tableau Public site at  https://public.tableau.com/profile/jim.dehner#!/vizhome/parameterworkbook/ValuePickerdrivendb?publish=yes

Enjoy

Jim



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Post splash image

My Blog Has Moved