Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Percentage calculation on Pivot

I'm new to Qlikview and struggling with some simple calculations.  I'm trying to show a percentage of headcount by department/headcount in a building.  Below is an example what I am trying to achieve for building A, but for each building.  I hard coded the total just show an example.  I've tried a number for formulas with Sum, but it never calculates correctly or at all.  How do I do this?percentage_calc.jpg

1 Solution

Accepted Solutions
maxgro
MVP
MVP

maybe

count(Head) / count(TOTAL <BL_ID> Head)

from online help

If the word total occurs before the function arguments the calculation will be made over all possible values given the current selections but disregarding the chart dimension variables.

The total qualifier may be followed by a list of one or more field names within angle brackets. These field names should be a subset of the chart dimension variables. In this case the calculation will be made disregarding all chart dimension variables except those listed, i.e. one value will be returned for each combination of field values in the listed dimension fields. Also fields which are not currently a dimension in a chart may be included in the list. This may be useful in the case of group dimensions, where the dimension fields are not fixed. Listing all of the variables in the group causes the function to work when the cycle or drill-down level changes.

View solution in original post

4 Replies
Anonymous
Not applicable
Author

Can you send me the expression you used for the final % calculation?

maxgro
MVP
MVP

maybe

count(Head) / count(TOTAL <BL_ID> Head)

from online help

If the word total occurs before the function arguments the calculation will be made over all possible values given the current selections but disregarding the chart dimension variables.

The total qualifier may be followed by a list of one or more field names within angle brackets. These field names should be a subset of the chart dimension variables. In this case the calculation will be made disregarding all chart dimension variables except those listed, i.e. one value will be returned for each combination of field values in the listed dimension fields. Also fields which are not currently a dimension in a chart may be included in the list. This may be useful in the case of group dimensions, where the dimension fields are not fixed. Listing all of the variables in the group causes the function to work when the cycle or drill-down level changes.

Not applicable
Author

To show the example I just used [Head Count by Department]/170.  170 is the total occupancy of building A.  I was trying to do something like [Head Count by Department]/Sum(TOTAL(<[Head Count by Department]> HEADCOUNT) but it doesn't calculate anything.  I've tried numerous variations.  The denominator calculation is what I am trying to get.  Thanks for your time.

Not applicable
Author

Yep.  That did it.  I used count(EMP_ID)/count(TOTAL <BL_ID> EMP_ID).  Thank you!