Using Parameters to Control Data in the View
- 1. Concept
- 2. Use a Parameter in a Calculation
- 3. Use a Parameter with a Filter
- 4. Use a Parameter to Swap Measures
1. Concept
A parameter is a workbook variable that can replace a constant value in a calculation, filter, or reference line. It allows you to customize the view according to your needs.
The parameters are global. This means that the value of the parameter is applied to every sheet where it is used.
2. Use a Parameter in a Calculation
Step 1. Create a parameter
- [Data] pane --> [Create Parameter] --> [Create parameter] dialog box
-
Settings:
[Name]
[Data type] : Float / Integer / String / Boolean / Date / Date & Time
[Current value] : the first number the parameter will use
[Display format]
[Allowable values] : All / List / Range
Step 2. Use the parameter
-
Create a calculated field
Step 3. Show parameter control
-
Right-click the parameter, and select [Show Parameter Control]
3. Use a Parameter with a Filter
[Mission] Make a < Top N Filter> parameter
Step 1. Add a parameter to a filter
-
a) Drag the dimension field to [Rows] / [Columns] --> click [Filter and then add] --> open the Filter dialog box
b) Drag the dimension field to [Filter] --> open the Filter dialog box
Step 2. Create and save the parameter
-
[Top] --> [By field] --> [Create a new parameter] --> Settings --> [OK]
-
Both the filter and parameter are created
Step 3. Show parameter control
-
Right-click the parameter, and select [Show Parameter Control]
4. Use a Parameter to Swap Measures
Using a parameter, you can create one view and give users the ability to choose which measure to display, which is called dynamic measure selection.
Step 1. Create a parameter
-
Create the parameter and include a list of values that represents each measure we want to show.
Step 2. Use the parameter in a calculation
-
Tie a parameter to something you’ll use in the view, such as a calculation, filter, or reference line.
-
use a CASE statement to match the parameter variables and return the correct measure data
Step 3. Show parameter control
- Use the parameter in the view and display the parameter control to enable users to switch among the measures
Step 4. Apply a dynamic title with the parameter