Monday, December 14, 2020

Dynamic Dimension Parameters!

Have you ever wanted the user to have the ability to select which fields are utilized in a Data Studio chart? For example, suppose you wanted to look at the breakdown of a school's population by various dimensions, such as Special Education status. Gender, ELL status, High Needs status, Economically Disadvantaged status, and Title I status. In the past, you would have needed to create multiple charts, one for each dimension...making for a very busy report!

Parameters are a relatively new feature of Data Studio, and have a wide variety of uses. Essentially, they act like variables to make your report even more flexible and interactive. Here, I'm going to walk you through how parameters can be used to choose the dimension for a pie chart in a Data Studio report, allowing all the options above to be displayed in the space of a single chart. Take a look at the following simple example to see how this operates:


Cool, right? Here's how it's done.

The data source Sheet contains a list of students, plus columns for various demographics: Gender, Special Education Status, High Needs Status, Economically Disadvantaged Status, English Learner Status, and Title I Status.

I created a Parameter called Demographics (Resource menu, Manage added data sources, Edit, Add Parameter) and gave it a list of values with the same names as my fields.

Note that parameters appear as purple in the field list, whereas fields appear green.



Then, I created a calculated field (which I also called Demographics) which contained the parameter. I did this because I want to use it in a CASE statement, so it needs to be a field rather than a parameter.

Finally, I created a calculated field called Demographics Selection using the following CASE statement: 


To create the simple report linked above, I created a filter control (Fixed-size list) based on the Demographics parameter, and also a pie chart where Demographics Selection is the dimension and Record Count is the metric.

Interested in learning more about using parameters within Data Studio to dynamically change dimensions? Check out the following blog posts which are what helped me figure this out. How can you imagine using this feature? Let me know!

Resources:






1 comment: