Skip to content

Building A chart with Dynamic Measure

3 min read · Updated 3 Nov 2026

The document will show how to create a chart that allows end-users to change the measure displayed in the chart.



Create the two base measures:

  • Sales Amount- showing the total sales amount
    ​

    New Measure dialog for Total Sales Amount, using Sum of the 1 Sales Salesamount field with format $#,##0.

  • Total Quantity- the total quantity sold
    ​

    Update Measure dialog for Total Quantity, using Sum of the 1 Sales Orderquantity field with format #,##0.

  • Create a measure with only a parameter.

    New Measure dialog with the Parameter type, value 1 and parameter name measureSwtich, named measure switch.

  • Create a conditional measure.

    With a formula similar to the formula in the image below.

    New Conditional Measure dialog: if measure switch equals numeric 1, then Total Sales Amount, else Total Quantity, named Chart measure.

  • Create a new numeric variable - measureSwitch set the default value to one.

    Variable settings for measureSwitch, of type Number with a default value of 1.

  • Create a string variable and name it selected measure.

    Default value: Sales Amount

  • Create a chart with the selected dimension and the measure created (Chart measure)
    In the measure properties, it’s important to connect the variable created in the previous (measureSwitch) step to the parameter in the measure.

    And the “selected measure” variable to the measure custom label.
    See the highlighted section in the image below

    ​

    Chart measure properties with the custom label set to the selected measure variable and measureSwitch linked as a defined parameter, both highlighted.

  • Add a dropdown control to the screen from the left panel.

    Controls panel in the left sidebar with the dropdown control highlighted in red.

  • Select the “selected measure” variable and define the options for the input they appear in the image below
    ​

    Dropdown input properties with the selected measure variable and custom options Sales Amount and Total QTY highlighted.

  • Place the control near the chart title or in another meaningful place
    and create a group containing the chart and the input form.
    The image below is one example.

    Bar chart titled Countries Performance by, with a dropdown set to Sales Amount beside the title, showing sales by country.

  • Open the Actions dialog

  • Drag the event: variable change to the canvas

  • Select the variable selected measure
    ​

    Actions editor block labelled Variable change with the selected measure variable chosen.

  • Add an IF..ELSE action block from the conditions section.
    ​

    Empty If..Else action block inside a Variable change block for the “selected measure” variable.

  • Define the conditions as they appear in the image below.

    If selected measure value = Sales Amount, set measureSwitch to 1, else set measureSwitch to 2, in a Variable change block.

    The action follows this logic:

    When the user selects an option from the dropdown menu,
    We change the variable value that determines the measure used in the chart measure.

Click on the preview button and test the chart by selecting different options from the dropdown options.
The result should be similar to the image below.

​

  • Only two options are supported.

  • The measure can be used in multiple charts, all of them will be impacted from the a change to variable