Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
ricardodeano
Contributor II
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
ricardodeano
Contributor II
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.

jensmunnichs
Creator III
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.

rubenmarin

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.

ricardodeano
Contributor II
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.

ricardodeano
Contributor II
Contributor II
Author

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

jensmunnichs
Creator III
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?

ricardodeano
Contributor II
Contributor II
Author

Hi Lens

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