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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Weighted average in a straight table

Hi,

  I want to create a weighted average in the totals row on a straight table. Basically we want to create a sum product of two columns and divide by sum of one column. Is it possible in qlikview?Thanks

Labels (1)
1 Reply
swuehl
Champion III
Champion III

Try something like

=if(dimensionality()=0,sum(aggr(FIELD1*FIELD2,DIMENSION))/sum(FIELD1), YOURROWEXPRESSION))

where sum(aggr(FIELD1*FIELD2,DIMENSION))/sum(FIELD1) is calculating the weighted average of FIELD2 weighted by FIELD1, and DIMENSION is your chart dimension (if you have more than one,
you need to specify all comma separated).

YOURROWEXPRESSION is the expression you want to show for the table rows.

If you don't want it different, you just can state

=sum(aggr(FIELD1*FIELD2,DIMENSION)) / sum(FIELD1)

Hope this helps,

Stefan