Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating average of two percentages.

Hi there,

Is there an easy way to determine the average of two percentage values? In the example below I want to determine the average of pie chart 1 and 2. Ive set the pie chart on option 'relative' so that it shows the percentages of the actual values. (the pie charts below it)

But now I want to determine the average of those percentages.  (% + %  ) /2 = average%

But this cannot be done because the actual values qlikview calculates with are the real values in the graphs below it. Therefor giving faulty percentages. How can I do this>?

why.png

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

'Relative' does the following calculation:

       Count({<operator={'T'}>}  object) / Count({<operator={'T'}>} TOTAL object)

Your average will probably be:

=( Count({<operator={'T'}>}  object) / Count({<operator={'T'}>} TOTAL object) +

Count({<operator={'O'}>}  object) / Count({<operator={'O'}>} TOTAL object) ) / 2



Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

6 Replies
Kushal_Chawda

what is the expression for %?

jonathandienst
Partner - Champion III
Partner - Champion III

You will have to calculate the average in full for the 3rd pie chart - it is not possible to get the calculation results from the other charts.

BTW - I think a pie chart is always relative - all that selecting relative would change is how the numbers are displayed in the legend and in the chart itself (if that option is enabled).

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

expresion:        Count({<operator={'O'}>}  object)

dimension:       Number

So it counts the amount of objects to the Number dimension.

For the second pie chart

expresion:        Count({<operator={'T'}>}  object)

dimension:       Number

Now in my third pie chart I want the average of the two percentages of the O and T operator.

Now I did: (which is totally wrong)

expresion           count( {<operator={'O','T'}>} object)

dimesnion:          Number

The relative checkbox, makes the actual values change to percentages. But I cannot reuse those percentage as Jonathan says. I was wondering if there was an option for that. Seems I have to calculate the number by hand then.

Kushal_Chawda

Can you post some sample data with expected output?

jonathandienst
Partner - Champion III
Partner - Champion III

'Relative' does the following calculation:

       Count({<operator={'T'}>}  object) / Count({<operator={'T'}>} TOTAL object)

Your average will probably be:

=( Count({<operator={'T'}>}  object) / Count({<operator={'T'}>} TOTAL object) +

Count({<operator={'O'}>}  object) / Count({<operator={'O'}>} TOTAL object) ) / 2



Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Yes this is indeed correct.

Makes sense now thank you.