Sunday, 20 May 2018

Creating a custom parameter and using it display dynamic visualizations in Tableau Desktop

Hi,

Before trying this post, let's read how to connect to postgresql database and query the tables in tableau in my previous post. 

Version  used for this exmaple: 2018.1.0

1)  From previous post, let's connect and query foodmart database.
2) Once the query is written navigate to the "Sheet1"(you can rename it as you want)
3) From the Measures section, right click on empty space and then select "Create Parameter..." option as shown in below image.

4) From the popped up "Create Parameter" window specify the parameter name, let's say "paramState" and fill the properties of it, Say type as "String", Current Value as "OR", and from the Allowable values: select "List" and fill manually the values into it.
 


5) Now, edit the custom SQL to provide the created parameter (paramState) to make the query dynamic as shown in below image.
(Click on image to get best view of the content)



6) Now, to show the parameter on the page with single select dropdown option.
    right click on the parameter and then click on "Show Parameter Control" option


This will get the parameter as dropdown on the console


6) Now, pull the fields to the shelfs and play with different values of parameter dropdown.
Output when select "OR" state 

(click on image to get best view of the content)
Output when selected "CA" state



NOTE: 

While exploring this concept, I was thinking whether it is possible to populate the values of parameter from a SQL query results and found below has some alternative approach to do.

https://community.tableau.com/thread/251724


Download the example 
Click here to download .twd file

This example is developed in latest version 2018.1 and not published to tableau server.

- Sadakar Pochampalli

No comments:

Post a Comment

Creating a custom parameter and using it display dynamic visualizations in Tableau Desktop

Hi, Before trying this post, let's read how to connect to postgresql database and query the tables in tableau in my previous post.  ...