Count the number of occurrences and their relative % in the column

I currently have a data frame with a column of Yes/No values that basically tells if a template was used to answer a certain question.

I would like to create a cauge indicating the performance metric "Template Usage" that should be above x% - and it is basically representing the "Yes" % on the column.

I cannot find a way to represent this - I have only been able count the number of "Yes" in the column, but I cannot translate this into a %. I assume this sohuld be possible, as a pie chart is able to do this.

I would really appreciate your help here! (Below are some images)

GoncaloFVO_2-1712234487375.png

GoncaloFVO_3-1712234490858.pngThe gauge is currently counting the number of "Yes" (1785) in the colmun that has over 5000 data entires. - Ideally I would like to show 1785/6000 ~ 30%

 

 

 

 

 

Solved Solved
0 3 75
1 ACCEPTED SOLUTION

In Looker Studio, gauge charts only display one metric.

So, we need to create a metric that calculates the percentage you're looking for. We can get this by turning the YES/NO value into a 1/0 value, then summing that and dividing by the total count.

SUM(IF(<used template>, 1, 0)) / COUNT(<used template>) * 100

Once you've created that, there's just a little fiddling to do with the ranges and targets. In my example, I made ranges for every 25%, set the target to 75%, and set the max axis to 100%. Images to follow:

Screenshot 2024-04-05 at 10.53.42 AM.pngScreenshot 2024-04-05 at 10.53.27 AM.png

 

View solution in original post

3 REPLIES 3

In Looker Studio, gauge charts only display one metric.

So, we need to create a metric that calculates the percentage you're looking for. We can get this by turning the YES/NO value into a 1/0 value, then summing that and dividing by the total count.

SUM(IF(<used template>, 1, 0)) / COUNT(<used template>) * 100

Once you've created that, there's just a little fiddling to do with the ranges and targets. In my example, I made ranges for every 25%, set the target to 75%, and set the max axis to 100%. Images to follow:

Screenshot 2024-04-05 at 10.53.42 AM.pngScreenshot 2024-04-05 at 10.53.27 AM.png

 

Thank you so much for the reply!
This did seem to work but just a quick question - the aggregation is currently set to SUM - does htis have any impact on the output?

Yeah, SUM should be fine! It would basically be summing our calculation over all the rows. But since the gauge chart only returns one row, it'll return the sum over just one row, which is the value itself.

Interestingly, my calculation is set to AUTO and I can't change it. But if I could, SUM is what I'd choose 😁

Screenshot 2024-04-05 at 12.23.16 PM.png

Top Labels in this Space