looker-studio

Can I use a drop-down list to switch between the input data metric in a chart?


I have air quality data from 5 different locations over the course of a week. I would like to have one chart and scorecard with a drop-down list that allows the user to select which location is displayed on the chart. Is it possible to accomplish this? Any insight is appreciated.

I've created a parameter with the list of locations as the control for the drop-down list. I need to tie the selection from the drop-down list to the input metric of the chart somehow. I'm trying to create a new calculated field but don't know how to structure it (essentially if the parameter = 1, then the input metric = School #1).


Solution

  • Yes it is possible but how depends on how you have your data set up. Looker studio does not work in the way you want it to, its not very good a linking tables together and is better at displaying data.

    You need a field in the data showing the location to place into a control to filter on, i am guessing from your question you have not got one.

    You can either give the parameter you have created the same Field ID as the Field on the field in the table you want to filter enter image description here

    OR

    You will need to add a calculated field with a case statement allowing you to change the name of what ever field or fields you are using to define location something like this

    CASE
      WHEN REGEXP_MATCH(Query, '(?i)1') THEN 'school1'
      WHEN REGEXP_MATCH(Query, '(?i)2') THEN 'school2'
      ELSE 'Other' 
    END