12.11. Parameter Example: Dynamic Metric
In this lesson, we'll explore how to create dynamic metrics using the same methodology as we did for dimensions. This will allow users to choose the metric they want to see for a particular dimension, providing a more versatile and customized experience.
- Understand the concept of dynamic metrics and their benefits in Looker Studio.
- Learn how to create dynamic metrics using case functions and parameters.
- Differentiate between optional metrics and dynamic metrics.
- Create interactive user interfaces to display dynamic metrics in tables.
- Apply dynamic metrics to real-world data modeling scenarios.
Main Concepts and Topics
- Dynamic metrics: Metrics that can be changed by users to customize their data exploration experience.
- Case functions: Used to create dynamic metrics by applying conditions to table metrics.
- Parameters: Text and available values used to create dynamic metrics.
- Optional metrics vs. dynamic metrics: Optional metrics are a more hidden way of providing users with metric choices, while dynamic metrics offer a more interactive and user-friendly experience.
Dynamic Metrics in Tables
We can use the same method we used for dimensions to create dynamic metrics. For example, imagine we have a table with breakdowns by source, medium, and campaign. We want to let users choose the metric they want to see for a particular dimension, such as sessions, page views, or users.
To achieve this, we'll apply a case function to the table metrics. The process is similar: create a parameter with text, available values, and a case function for the table metric.
For instance, if the table metric is sessions, display sessions; if it's page views, display page views. This method allows users to choose the metric they want to see and apply it to their data.
In a real-life example, we worked with a company whose CEO wanted to see different metrics for their stores on different date ranges without creating separate pages. We built an interface allowing them to choose from various metrics, such as sales, transactions, customers, and products sold.
Optional Metrics vs. Dynamic Metrics
Optional metrics are another way to provide users with flexibility in their data exploration, but they can be hidden and not immediately obvious to users. To make optional metrics more visible, always show the chart header and include a text prompt, such as "Select your metric."
Dynamic metrics, on the other hand, can provide a more interactive and user-friendly experience when you have the resources to create a more sophisticated user interface.
In conclusion, dynamic metrics can be a powerful tool for customization in Looker Studio, giving users the ability to choose the metrics they want to see for their data. This versatile method can help create a more engaging and personalized experience for users when exploring data.