Google Data Studio

Google Data Studio – Customized labels for pie & donut charts

Data label is an optimized solution to avoid the use of chart legend, putting directly the right and short information inside your chart. But sometimes we face constraints and limitation for customization inside Google Data Studio, especially for donut charts and pie charts.

The simple trick below will help you to customize labels for your pie & donuts charts, and display data you need, with the wished format.


Google Data Studio customized_label for pie and donut chart

Result & ingredients

In the picture above, I take the example of Sessions by Device Category from Google Analytics demo account. Pie and donut charts are recommended with very low number of dimension values, “Device Category” is the kind of good dimension candidate to play with donut charts, just 3 possible values.

To build this chart, we need the following elements:

  • Blended data to control the calculation of percentage & apply formula with unaggregated metrics
  • a donut chart with labels
  • A calculated field for the displayed label

yep, nothing more.


1. Blended data

Then, configure a blended data as configured below for our example:

  • As left data source
    • Data source: Our main data source, here Google Analytics data source
    • Join keys: None
    • Dimensions: Device Category
    • Metrics: Sessions, renamed “Sessions by Device Category”
  • As right data source
    • Data source: Our main data source (again)
    • Join keys: None
    • Dimensions: None
    • Metrics : Sessions, renamed “All sessions”


2. Donut or pie chart

Then, create your donut or pie chart as described below:

  • Data tab
    • Data source: Your blended data
    • Dimension: One of the calculated field below and name it “Dimension label”
    • Metric: Sessions by Device Category, for this example
    • Sort: Sessions by Device Category, descending
  • Style tab
    • Color by slice order, considering you need to highlight the top 1
    • Label: Adapt the text size and select “Label” option as the displayed label
    • Hide the legend
    • And adapt the other options regarding your report styles

Donut chart configuratio for customized labels

3. Calculated field to use as chart dimension

At last, regarding the label your wish to display, use one of the calculated fields below (or build your own) as chart dimension, and name it “Dimension label”.

Rounded pourcentage

In most of cases, we really don’t need decimal portion on pie chart percentages.😝

Dimension label
CONCAT(CAST(ROUND(ROUND(Sessions by Device Category/All sessions,2)*100,0) AS TEXT),"%")
Donut chart label with rounded percentage

Dimension & round percentage

Dimension label
CONCAT(Device Category," (",CAST(ROUND(ROUND(Sessions by Device Category/All sessions,2)*100,0) AS TEXT),"%)")

Rounded percentage & compact value

Dimension label
CONCAT(CAST(ROUND(ROUND(Sessions by Device Category/All sessions,2)*100,0) AS TEXT),"% (",CAST(ROUND(Sessions by Device Category/1000,1)AS TEXT) ,"k)")
Donut chart label with percentage and value

“Voilà!”