Sunday 1 November 2015

Parameters - Tableau

Parameters – Parameters are dynamic variables that can be used as placeholders in formulas.
And we can replace constant value by dynamic value

EX: Dynamically selecting Columns (Fields), Dynamically selecting Top 10,
Bottom N

EX: Dynamically Select Measure Field.
1) Right click in dimension window, click on Create Parameter.
2) Define the Type: String,
3) Select List option since we are defining manually.
4) Create a calculation like below,
if [Parameter] = "Sales" then [Sales] else [Profit] end
5) Drag the Region onto Rows shelf, drag the above calculation into Column's shelf.
6) Right click on Parameter, click on "Show Parameter Calculation"
7) Now we can Select Either [Sales] or [Profit].

Note: As of  now in Tableau we can select 1 Value max at a time.

1) Dynamically select the Color.

1) Create a Parameter “Color” with the Following values like the below screen shots.
Green, Blue, Red, Orange
2) Drag Region onto Row Shelf, Sales onto Column Shelves.
3) Create a Calculated field like the below
Name: Dynamic Color
case [Color]
when "Green" then "Green"
when "Blue" then "Blue"
when "Red" then "Red"
when "Orange" then "Orange"
---- ------ Here [Color] is the Parameter which was created in the 1st step.
4) Drag “Dynamic Color” onto Colors mark.
5) Right click on “Color” parameter, click on “Show Parameter Control”.
6) Now select colors 1 by 1 from “Parameter” then assign right colors.

Note: As far now (up to V 9), we can pass Max 1 Value through Parameter, it doesn't allow to pass multiple Values.

Parameter - Options:
1) If you to show parameter values from any specific column, Select List Radio Button
from Allowable Options then select Add from Field, then select the Field.

2) If you want to create a Parameter on specific column, right click on that,
click on "Create Parameter".

Additional Information:
1) We can get the values into parameter either by right click on specific field & click on "Create Parameter".


Right click on white space in measures pane, click on "Create Parameter" then define the "Data Type" then click on "List" then click on "Add values from Field".

No comments:

Post a Comment