Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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
erich_shiino
Honored Contributor

Re: percentage in a pie chart

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

8 Replies
pat_agen
Valued Contributor

percentage in a pie chart

hi,

go to properties->Expressions

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

that should do the trick.

erich_shiino
Honored Contributor

percentage in a pie chart

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

percentage in a pie chart

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

erich_shiino
Honored Contributor

Re: percentage in a pie chart

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

percentage in a pie chart

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

erich_shiino
Honored Contributor

percentage in a pie chart

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

percentage in a pie chart

Thank you very much =)

Not applicable

Re: percentage in a pie chart

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.

Community Browser