Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a simple histogram (representing a distribution) in Google Data Studio?

Do you know if it's possible to make a simple histogram representing the frequency of all my values divided by ranges (0-5;5-10;10-15;15-20 ...) ?

Exemple:

enter image description here

like image 455
Olivier Avatar asked Oct 13 '17 07:10

Olivier


People also ask

What is a histogram chart?

A histogram is a chart that groups numeric data into bins, displaying the bins as segmented columns. They're used to depict the distribution of a dataset: how often values fall into ranges.

Is Google data Studio free?

Data Studio is a free tool that turns your data into informative, easy to read, easy to share, and fully customizable dashboards and reports.


2 Answers

This may have gotten easier over time, but you shouldn't need to define every bin by hand anymore. If you can edit your data source, you can add a calculated field in Data Studio with a formula like this:

FLOOR(age/5) * 5

If you call this field, say, "age_bin", all entries will have a value that's a multiple of 5, with the label (the value of age_bin) indicating the bucket's minimum value. For example:

  • An age of "4 days" would be in bin 0, because FLOOR(4/5)=0
  • An age of "36 days" would be in bin 35, because 36/5=7.2, so FLOOR(7.2)=7, and 7 * 5 = 35

You can then make a bar plot with "age_bin" as the dimension, and "Record Count" as the metric.

like image 113
rabdill Avatar answered Oct 05 '22 07:10

rabdill


The easiest way would be to format your data into "bins." You could do something like this:

count(CASE WHEN Age > 0 AND Age <= 5 Then 1) AS bin1
count(CASE WHEN Age > 5 AND Age <= 10 Then 1) AS bin2
count(CASE WHEN Age > 10  AND Age <= 15 Then 1) AS bin3
count(CASE WHEN Age > 15 AND Age <= 20 Then 1) AS bin4

This is the easiest way to get your data into a histogram-type format, and then select one of the bar charts available in GDS.

like image 45
Lindsay Reynolds Avatar answered Oct 05 '22 06:10

Lindsay Reynolds