Help with Using Parameters to Change Metrics

I am trying to implement this parameter to have a dropdown to dynamically change a pie chart dimension. What I want to achieve is to be able to switch between two different pie chart views (one based off of the dimension of server Location and another based off of server Disposition/Status), but both will have the same metrics.

I added the following parameter called View Type (with the intent to use it in a dropdown):hsu_r_11-1729115984158.png

And then added a field called Label to correspond with the parameter.hsu_r_12-1729116000838.png

And then added a new field ChartView that ideally will change between my database fields Data Center and Disposition, depending on what is selected based off of the parameter View Type:hsu_r_13-1729116054621.png

I then tried to add in my dropdown (based off of the parameter) and pie chart:hsu_r_14-1729116091900.png

Drop down seems to look fine, however, pie chart will not work and the error that gets thrown is this:hsu_r_15-1729116110985.png

This is the set up of the pie, and to my understanding and research, should work (based off this article I found https://phoenix-analytics.medium.com/looker-studio-dynamic-metrics-e4d147103877). Where the dimension I want (ChartView) will change dynamically based off of the parameter that is selected in View Type. And therefore my pie chart can change dimensions with this field. Any ideas on what might be causing the error?

0 2 669
2 REPLIES 2

I'm wondering why you used 1 and 2 in your parameter, rather than the labels themselves, although I agree it seems like what you've done should work.

I would set up the View Type parameter as text with the two options, Disposition and Location (as both the parameter's Value and the Label). Then I would just use the parameter in the ChartView CASE statement (instead of your calculated Label field), and scrap that Label calculated field. I'm not sure about the error you're seeing, so it may be an issue with your data source, in which case this alternative may not help, but it's worth a try.

 

I just changed it to your suggestion and I am still getting the same error. Additionally, the alias of "t" in "t.DataCenter" seemed to have been generated by Looker Studio because my data source is a fairly simple Custom SQL query. This is my first time using Parameters in Looker Studio so I'm not sure if I'm just not using them properly? But I followed that guide I found online step-by-step and each field I created threw no errors. I'm really scratching my head on this because it would be a very crucial piece in my dashboard if this could work.