Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for
Did you mean:
Contributor II

## Create a pie chart using calculated expression

Good morning

My head isn't working at all today so please forgive this question. I have the following expression that calculates a percentage:

(Count({<Response={'0','1','Unsure'}>}Response)/Count(Question))*100

How would I go about a pie chart that effectively demonstrates this simple percentage?  I can't seem to get my head around what would be the dimensions and measure(s)

7 Replies
Contributor II
Author

Actually, the request from the client was for a pie chart but using a gauge looks far better in my opinion - that way I can use the expression as is above.

Creator III

What exactly is your pie chart supposed to show? If I had to guess, you want to show the amount of questions that got reponse 0, 1, or Unsure as a percentage of the total amount of questions?

In that case, just use response as dimension and use Count(Question) as expression. To make it a percentage, tick the 'relative' checkbox for the expression. If there are more types of responses and you only want those 3, add your set analysis to the expression. If there are more than 3 types of responses but you still want the rest to be taken into account in your percentage and show them as 'other' in your pie chart, I think you can solve that by creating a calculated dimension (if (response = 0 or response = 1 or response = unsure, response, 'other'))

If your questions is 'what percentage of questions is either 0, 1, or unsure?', then yes a gauge is probably better, and your expression should just work like that.

MVP

Hi Richard, pie tables distributes a 100%, so you can add 2 expressions:

- one with the percentage to show

- another to complete the 100%: (1-(Count({<Response={'0','1','Unsure'}>}Response)/Count(Question)))

Note that the gauge chart can be changed in presentation chart to show 360 degrees and 0 inner area, also changing the 'Mode' to fill the gaude it can look similar to a pie chart.

Contributor II
Author

Hi Jens, yes your final question is the definitive question so the gauge is definitely the visualisation to use in this case. Apologies for the delay in replying, kids have been on half term holiday.

Contributor II
Author

Good morning Ruben - thanks for this clarification, most appreciated and apologies in the delay replying.

Creator III

Hey, don't worry about it. Do you still need help with this, or have you managed to figure out how to create the gauge chart?

Contributor II
Author

Hi Lens

Yeah I managed to sort the gauge pretty easily thank you.

Community Browser