Search code examples
visualizationpie-chartlooker-studio

Google Data Studio Visualize Count of Distinct Events in Pie Chart


We have a list of tasks on the website that all users need to perform before they are able to apply for a job. Tracked by Events

I'm able to create a table by userid that shows all the task that were completed by that user and then I'm able to create a table that shows distinct count of all tasks they've finished.

To count the task events, I've created a new metric

COUNT_DISTINCT(Event Action)

Then using a filter to show the task I'm interested in.

Tasks completed by User:

User ID Count of Tasks Completed
1 11
2 11
3 11
4 10
5 9
6 9
7 4
8 4
9 4
10 2

What I'd like to do is show a pie chart that display the % of users that completed a certain number of tasks. For example 30% completed 10 tasks, 20% completed 9 tasks, etc.


Solution

  • Took a while, but I finally figured this one out.

    First you have to create three new metrics, one to count distinct events and one to count distinct user IDs You need a third to convert the distinct event counts into a usable metric for calculating a completion % and is based on the distinct event counts.

    enter image description here

    enter image description here

    enter image description here

    Then I created filters to isolate the specific events I'm interested in.

    Since you can't re-aggregate data or apply filters based on a custom metrics in a data source, I created two separate tables with the necessary filters in order to blend the data.

    enter image description here

    I then blended the data and created the necessary additional filter based on the event count and applied to desired blended source. In this case, I want to see all users with an ID that finished 11 tasks.

    Blended table

    enter image description here

    Blended data source

    enter image description here

    The final step is divide the total number of desired events / total users to get a completion rate.

    enter image description here

    And here's the custom metric for that.

    enter image description here

    This is pretty controverted and took taking several technics from several blog sources and combining them into one work flow.