Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

percentage in a pie chart

Hello everyone !

I have a pie chart with the number of men and the number of women, but I'd like to add the percentage on each section of the part chart. How can I do that ??

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

This can be a bit more tricky...

you can use a dual expression:

dual(  sum(number) & chr(10) &

num( sum(number)/sum(total number), '##%')

, sum(number))

You can check my attachment.

Hope this helps,

Erich

View solution in original post

8 Replies
pat_agen
Specialist
Specialist

hi,

go to properties->Expressions

click on Relative, click on "Text on Data Point".

that should do the trick.

erichshiino
Partner - Master
Partner - Master

On the chart properties -> Expressions tab, you can select your expression and check the box 'Relative'

or your expression could calculate the % of a value directly, with something similar to this:

sum( Value) / sum( total Value)

where Sum( Total Value) will automatically be the Sum( Value) of all the possible values of your dimensions.

Hope this helps,

Erich

Not applicable
Author

It works but it indicated only the percentage. Can I have both, number and percentage ?

erichshiino
Partner - Master
Partner - Master

This can be a bit more tricky...

you can use a dual expression:

dual(  sum(number) & chr(10) &

num( sum(number)/sum(total number), '##%')

, sum(number))

You can check my attachment.

Hope this helps,

Erich

Not applicable
Author

Just a last one little question, I have my customer field which is M or F. What should I writte for count only the M or only the F ?  (something like count(customer) where customer=F)

thank you for your help

erichshiino
Partner - Master
Partner - Master

In that case, you can use set analysis.

count ( { <customer = {F}> }  customer)

if the value you need has spaces you can use single quotes

count ( { <FIELD = {'A B'}> }  customer)

you can use comma to filter more than one value:

count ( { <customer = {'F', 'A B'}> }  customer)  (for customer = 'F' or customer = 'A B'

Regards,

Erich

Not applicable
Author

Thank you very much 😃

Not applicable
Author

Tried the dual solution but never got it working, was trying to present both sales amount and % of sales for several customers, so was working with more than 2 alternatives...also other limitations like timing and so on.

Found a much easier solution, simply copied the expression (sum of sales for period x, customer in dimension) so I had 2 identical, and made one of them "relative"...since the proportions are exactly the same, it worked like a charm. getting both sales figure and % of sales.

Not perfect when zooming in to the small slices as the % is the percentages of % shown (maybe this was an issue with the dual solution as well?), but the overall picture works.