Skip to main content

Alternative Measure in Charts

Astrato Support avatar
Written by Astrato Support
Updated over a week ago

Introduction

Switching the active measure (KPI) in one or more visualizations allows users to analyze data from different perspectives using the same dashboard and to drill down on KPIs.
The document will describe how to build a solution that allows end-users to change the active measure in visualizations.
​



Semantic Layer- create the measures

In the semantic layer, we'll create a few measures to support the use case

  • Create the two measures to be displayed in the chart.

  • Create a measure that only includes a parameter.
    ​

  • Create a Conditional measure and use the three measures from the previous steps.
    The measure should look like this:
    ​

Workbook

  • Define Variables

    In the workbook, create two new variables.

    • A numeric variable with the same name as the parameter in the measure created in the previous step.
      Set the default value to one.


      ​

    • A string variable gives it a name and sets the default value to the name of the default measure.
      ​


      ​

  • Define Actions

    Open the Action editor and create a new action block.

    The Action block will track changes in the "Selected Measure" variable
    And change the value of the numeric variable accordingly.

  • Build Visualizations

    Create a visualization using the conditional measure created in the semantic layer section.
    In the measure settings:

    • Activate the custom label and use the "Selected Measure" variable

    • Make sure the numeric variable is tied to the measure.
      ​


      ​

  • Build a Control to Change the Active Measure

    • Add a drop-down atomic input form to the screen.
      ​


      ​

    • Use the "Selected Measure" variable and define the option for the drop-down list as displayed in the image below.
      ​


      ​

  • Test

    Preview the app and change the value in the drop-down list to test the solution.
    ​


    ​


Drive alternate measures & dimensions using variables & dropdowns

A new, fast approach to choosing dimensions, measures and columns, without relying on actions. Charts that share measures/dimensions can use a single dropdown.

How it works (simple)

  • Create a variable (e.g. Selected Measure)

    • We recommend creating another variable to list all options (e.g. All measures), to ensure users have an up-to-date list of all available options

  • Use Visibility conditions on measures or dimensions

  • Each item listens to the same variable value

  • Change the dropdown β†’ charts update instantly

Did this answer your question?