Google Data Studio – Pie chart & donut chart for your standalone rate metric
The purpose of this article is not to debate about the right cases & visualisation opportunities to use controversial pie charts or donut charts. This post is just made to address a simple need 🙂
Through this tip, we will see how to create inside Data Studio a donut chart when we wish to show graphically a simple rate, so a standalone metric. Already aggregated. Without dimension to break down the related raw values of metric by dimension, contrary to what requires Data Studio by default for this kind of chart.
The graphical result corresponds to a two-slice chart illustrating the dual proportion of a rate with, on one hand a strong color for the active slice and, on the other hand, a neutral color for the rest of the opposite slice. Probably more eye-catcher inside a dashboard with a series of metrics, comparing to a simple scorecard.
I’ve chosen donut chart, but of course, pie chart does also the same job.
Result & ingredients
In the picture above, I take the example of engagement rate from a demo account of Google Analytics 4, but you can do exactly the same for any already calculated rate from any kind of data source.
(Of course, it is definitely not recommended for very low rates. The related active slice would not be enough visible, less effective)
To build the donut chart, let’s put in action some elements:
- A Google Sheets data source to store active and inactive state of the chart (slice names)
- Blended data to merge the rate metric from your data source with the previously mentioned Sheets data source for fake breakdown
- A donut chart or a pie chart to visualize our data
- A calculated field to assign the right metric to the right slice
Really simple and a new roundabout way to use data blending, like in a previous article to transpose columns of metrics to rows.
1. Google Sheet data source
First, create a simple Google Sheets with one tab containing the 2 dimension values of donut slices, corresponding to the 2 states of the chart: active Vs inactive slice.
2. Blended data
Then, configure blended data as described below for our example:
- As left data source
- Data source: Google Sheet data source with slice names
- Join keys: None
- Dimensions : State
- As right data source
- Data source: Main data source, here Google Analytics 4 data source
- Join keys: None
- Metric: Engagement rate
3. Donut chart or pie chart
At last, create your donut or pie chart:
- Data tab
- Data source: Your blended data
- Dimension: State
- Metric: A chart calculated field with formula below, named as “Rate”
- Sort by State (so the dimension) ascending
- Style tab
- Color by dimension values, applying the wished colors for “Active” and “Inactive” values
- Hide the label
- Hide the legend
- Do not show the header
Calculated field to use as chart metric
Rate
IF(State='Active',Engagement rate,1-Engagement rate)
VoilĂ , finished!
Example of result
I thought about this trick and the related visualisation when I built the design of the example below for previous page flow with Google Analytics data. It is included in an advanced template about UX and page analysis.
The donut charts play their part, drawing the attention to the more important flow type as first level of reading.