What is Parameter?
Any characteristic that can help define or categorize a specific system is, in general, considered a parameter. In other words, a parameter is a component of a system that is useful or essential for identifying the system or assessing its functionality, status, or other aspects.
Data Sources Using a Parameter
Make the first view:
- Connect to the Superstore example data source in Tableau Desktop. (If appropriate) Drag the Orders table to the canvas from the Data Source page.
- Connect to the Coffee Chain data source by going to Data > New Data Source.
- Drag the CoffeeChain Query table to the canvas on the Data Source page, then click the sheet tab.
- Drag the Date shelf to the Columns shelf.
- Click the + button next to Year (Date) on the Columns shelf to see Quarter and Month as well. Take out the quarter.
- Profit and sales should be moved to the right shelf.
- Select Dual Axis from the Sales menu.
- Select Synchronize axis from the menu that appears when you right-click the new axis.
- Select Pick Worksheet > New Worksheet, and then in the Data window, select the Superstore data source.
- Drag the Order Date shelf to the Columns shelf.
- Click the + button next to Year (Order Date) on the Columns shelf to see Quarter and Month as well. Take out the quarter.
- Drag the Sales shelf to the Rows shelf.
- Drag Category to Color and choose “Bar” from the Marks drop-down menu.
- Make a new dashboard, then drag Sheets 1 and 2 onto the canvas.
Create a custom parameter and use it in a calculated field.
1. In the Data window, with your workbook open and Sheet 1 (and the Coffee Chain data source) selected, click the drop-down arrow at the top of the Dimensions pane, and then select Create Parameter.
- Enter “Select State” as the name.
- Select “string” as the data type.
- Select from a list of allowable values.
- Select Add from Field > Sample – Coffee Chain > State from the List of Values.
- When you’re finished, click OK.
2 . Complete the following steps in the computed dialogue box:
- Enter “State Filter” in the name field.
- Enter the following formula in the formula box and click OK when completed.
- [State Select] = [State]
Note: This computation determines if the parameter state matches the state field in your data source and returns true or false.
3. State Filter should be dragged to the Filters card.
4. Select True in the Filter dialogue box, then click OK.
5. Rep steps 3–5 on Sheet 2 (which uses the Superstore data source).
It is not necessary to recreate the Select State parameter.
Make use of the parameter
- Go to the dashboard, then pick Parameters > Select State from the drop-down arrow for one of the displays.
- Choose a state using the parameter control.
Views that utilize one or both data sources must refresh to display data from the specified state.