Using Parameters to Control Data in the View


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

image-20210611085437341 image-20210611091113430


  • 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

    image-20210611090401553 image-20210611091146937


Step 3. Show parameter control

  • Right-click the parameter, and select [Show Parameter Control]

    image-20210611090801657 image-20210611090916567



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

    image-20210611091755122 image-20210611091620060


Step 2. Create and save the parameter

  • [Top] --> [By field] --> [Create a new parameter] --> Settings --> [OK]

    image-20210611092143936 image-20210611092346025 image-20210611092524428


  • Both the filter and parameter are created

    image-20210611092939904

Step 3. Show parameter control

  • Right-click the parameter, and select [Show Parameter Control]

    image-20210611093058789 image-20210611093137142



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.

    image-20210611104005746

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

    image-20210611104353589

Step 3. Show parameter control

  • Use the parameter in the view and display the parameter control to enable users to switch among the measures
image-20210611104549840

Step 4. Apply a dynamic title with the parameter

image-20210611110246784 image-20210611110317775