Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
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

Re: How to do weighted average in Qlikview?

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.