Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

How to calculate Sum of Means ?

Help me write some expressions, attached is the sample document

My first chart i.e. "Avg Mean Price Per Product" would be like

Sum(Mean price of all purchases of a customer)/Total Number of Customers

My first chart i.e. "Avg Mean Price Per Product" would be like

Sum(Max price of all purchases of a customer)/Total Number of Customers

***     There can be multiple purchases for a product against single customer. I have updated the document too.

Any help is highly appreciated.

Message was edited by: Mubbasher Khaliq (Multiple purchases for a product against single customer added)

1 Solution

Accepted Solutions
Highlighted
Master II
Master II

Re: How to calculate Sum of Means ?

You should add Customer as dimension to aggr, otherwise you choose to calculate aggr() regardless of customer (aka total<> modifier).

Read the help about aggr() function.

View solution in original post

10 Replies
Highlighted

Re: How to calculate Sum of Means ?

If you want to average per customer, then sum the averages, you should use

     Sum(Aggr(Avg(Price),Customer))

HIC

Highlighted
Master II
Master II

Re: How to calculate Sum of Means ?

Hi.

aggr() function can help you to calculate the expression for the aggregation level that differs from the chart dimensions.

Highlighted

Re: How to calculate Sum of Means ?

Here it is

Highlighted
Specialist
Specialist

Re: How to calculate Sum of Means ?

Hi,

Have a look on RangeAvg() function.

Highlighted
Master II
Master II

Re: How to calculate Sum of Means ?

See the attached file

Highlighted
Not applicable

Re: How to calculate Sum of Means ?

Thanks, This helped me a lot , but when I write this expression

If within Aggr function I use Sum/Count rather than Avg then the out put of Count is not right. As can be seen below.

Expression:

Sum(Aggr(Count(1),Product))

Output:

Product Count Per Customer.png

Why it is counting every product count against single customer.

Desired Output:

Desired.png

Highlighted
Not applicable

Re: How to calculate Sum of Means ?

Please check my reply to above post. Thanks.

Highlighted
Master II
Master II

Re: How to calculate Sum of Means ?

You should add Customer as dimension to aggr, otherwise you choose to calculate aggr() regardless of customer (aka total<> modifier).

Read the help about aggr() function.

View solution in original post

Highlighted
Master II
Master II

Re: How to calculate Sum of Means ?

Since QV can't choose the customer to show the result it takes the first one.

To make the aggr() working as total modifier you should add 'nodistinct', then QV repeats 25 for each customer.