Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

Agg function

Hi,

May andbody explain to me the use of agg function.

maybe with a little sample.

Thxs,

1 Solution

Accepted Solutions
cesaraccardi
Specialist
Specialist

Hi,

Thats right. The expressions with aggr may look a little confuse if you dont visualize it with a sample, but the concept is really simple.

Regards,
Cesar.

View solution in original post

5 Replies
cesaraccardi
Specialist
Specialist

Hi,

lets say you have the following table:

Order IDItemValue
1A10
1B5
1C2
2A3
2D4
3B6
3E3

Then you want to know the average value by Order... if you just use an expression like avg(Value), the result will be the average by Item (4.71) and not by Order (11). So in this case you need to change the aggregation, and thats the purpose of the Aggr function.

In this case you could use something like:

avg(aggr(sum(Value), [Order ID]))

This expression means the average of the Values aggregated by Order ID.

Regards,
Cesar.

alec1982
Specialist II
Specialist II
Author

Hi,

thanks for the replay..

Would that mean the result will be:

1     (10+5+2)/3

2     (3+4)/2

3     (6+3)/2

Thxs,

cesaraccardi
Specialist
Specialist

Hi,

Thats right. The expressions with aggr may look a little confuse if you dont visualize it with a sample, but the concept is really simple.

Regards,
Cesar.

alec1982
Specialist II
Specialist II
Author

Thxs for the quick responses.

Not applicable

Hi Cesar,

I have small doubt after looking at the explanation which u have posted.The expression has to be the same as above.But if we use that in Bar char as the dimension if we use OrderID then what will be the result.Please clarify this doubt.

Regards,

Deepthi