Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to do weighted average in Qlikview?

Hi, I am using the below formula to find average value for my analysis:

=AGGR(AVG({<[Service Type]={'Transaction Cost'}>} [Total Services Charges]), Bank, Country))

The problem I am facing is average value including all the values is $195(example) but it is showing $90 which is average of average value of 2 countries i.e. average value for India is $80 and Average value for US is $100. So it is finding average of average instead it should do weighted average and return $95 instead of $90.

Can anyone help me with this?

Thanks in advance.

1 Reply
swuehl
MVP
MVP

Your aggr() functions is missing an outer aggregation.

Use Aggregation Functions!

To tell you more, it's necessary to know the data at more granular level, what you need to consider as grouping entities for your average and in which context you are using the expression.

Average – Which average?

It might be enough to do something like

=Sum({<[Service Type]={'Transaction Cost'}>} [Total Services Charges]) / Count(Distinct Bank)

but that's a wild guess.