Dynamic dimensions on your dashboard

Data Pipeline

Using the Pipeline, it is possible to have the ability to dynamically change between dimensions on your dashboard. For this example, we are using Chartio Demo data based on Postgres.

  1. On the dashboard, click Add Control from the sidebar and choose Dropdown.
  2. Switch to SQL Mode and type in the following and click Run Query:

    SQL codeblock

    If you have more than two dimensions, add additional UNIONs and SELECTs with the dimension names. They will need to match the names exactly as they are in the table or chart.

  3. Below the SQL Editor, rename the variable to something unique like DIMENSION. Make sure that Multi-select is unselected. Add one of the dimension names as the Default Value. We are using Rep Name in this example.

    Select dropdown settings

  4. If you already have your table created, chose to Edit it. If not, create a new chart and add both dimensions and both measures to the chart.
  5. Once the initial columns are added, add a step in the pipeline. For this example, click Add Column and name it. Choose Custom formula and enter a case statement:

    CASE WHEN {DIMENSION} = ‘Rep Name’ THEN “Rep Name” ELSE “State” END

    Add Column in Pipeline

    If you have more dimensions, add additional WHEN and THENs. Click Apply and Close.

  6. Add a Hide Columns step in the Pipeline and select Rep Name and State.
  7. Add a Group step in the Pipeline. Group on the Dimensions column and Sum on the two Measure columns.

    Group in Pipeline

  8. Reorder the new dimension column to the top of the list and rename the measures as wanted.

Related Data Pipeline Help Articles

See more