Question

How to display two measure in piechart

  • 11 January 2018
  • 11 replies
  • 2319 views

is it possible to display two measure in piechart ??


11 replies

Userlevel 5
Badge

Hi @shaheen_shaikh96,

It’s only possible to display one measure with a pie chart. These docs show how that work. Basically, the dimension decides the number of slices and the measure decides the size of the slice.


If you want to add a pivot, you can use donut multiples. It’s similar to a pie chart except that you get one chart per pivot value.


If these don’t satisfy your use case, feel free to share some examples of what you’d like to see!

Userlevel 5
Badge

Donut Multiples technically accept two measures; you get one chart per dimension and then each chart is split by the measure values.

Hey Sam,

Thanks for your suggestion.Is there any possibilities to display two measure in pie chart using derived table?

Userlevel 3
Badge

Hi @shaheen_shaikh96 yeah if your data comes from a Derived Table you can also plot this in a pie chart!

As Sam was mentioning you can achieve the plotting of 2 measures via the Donut Mulitple option (without a dimension selected in the query):

Userlevel 2

I also have a use case where I need to display several measures in a piechart. My case:

I have a table (simplifying here) with a column server, errors_type1, errors_type2, errors_type3. Each of the errors columns have the number of that type of errors that occured on that server.I created a measure for each column being the sum of total of each errors type.

What I want to do: create a pie chart with the slices being the sum of all errors


Example:

server errors_type1 errors_type2 errors_type3

server1 5 3 7

server2 1 8 10

server3 0 2 4


The pie would be 3 slices:



  • errors_type1 size 6

  • errors_type2 size 13

  • errors_type3 size 21


How can I do that?

Userlevel 1

Hey there @maryliag! It sounds like our goal here is to create a pie chart with the dimension error_type and the sum per error type, which will be our measure that we’ll call size in this case. And that the complication surfaces because error_type is really a measure since it is representative of a count per error type. Would it be possible to create a dimension error_type ?

Userlevel 2

I have a dimension for each error column, but that dimension would only count for the amount of errors on that server, what I want is the total of that error in all server

Userlevel 1

Hey @maryliag,

To clarify on my end, would it be possible to create a dimension error_type that would render 1 for error_type1, 2 for error_type2, 3 for error_type3, etc? So we could select error_type and size which will result in the size being grouped by error_type (1,2,3…) in a pie chart. This would be the most robust way to go about it. In our example here, we have one dimension per error type. My suggestion involves encapsulating the error type numbers into one dimension so that we can use it in a pie chart. Example dimension:


server  | error_type
--------------------
server1 | 1
--------------------
server1 | 1
--------------------
server1 | 1
--------------------
server1 | 1
--------------------
server1 | 1
--------------------
server1 | 2
--------------------
server1 | 2
--------------------
server1 | 2
--------------------
server1 | 3
--------------------
server1 | 3
--------------------
server1 | 3
-------------------
server1 | 3
--------------------
server1 | 3
--------------------
server1 | 3
--------------------
server1 | 3

Userlevel 1

Hey @maryliag! Feel free to send an email to help.looker.com. You can include example screenshots of your current explore results and that can help us review and better understand your use case.

Userlevel 2

I was able to make it work, thanks!

I created a new view with a select that gave me the table in the format

server error_type error_count

server1 type1 1

server1 type2 5


with this a have a dimension for error type and a measure for sum of error count

Userlevel 1

@maryliag That’s great to hear! Thank you for letting us know that your question was resolved.

Reply