Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
gkcchowdary
Creator
Creator

what is aggr function

Explain aggr function

5 Replies
Anonymous
Not applicable

Hi,

Think of the aggr() function as making a temporary table. For instance, let's say we have this real table of data:

Customer, Value
A, 20
A, 30
B, 10
B, 15
C, 40

Now, as a  requirement, let's say that we're looking for maximum value by customer, and then the minimum of THAT value across customers. Our max value by customer is A=30, B=15, C=40. Our min of those is 15. Note how we built a temporary table with three rows while calculating it. Aggr() is one way to build this temporary table. Our dimension is Customer, and our expression is max(Value). We could build this as a real chart, but instead we want to use it in an expression without doing so. The general format for aggr() is this:

aggr(expression, dimensions)

So in our case:

aggr(max(Value),Customer)

We're trying to extract the minimum from that temporary table, that list of values, so we just enclose it in min():

min(aggr(max(Value),Customer))

Anonymous
Not applicable

jagan
Luminary Alumni
Luminary Alumni

Hi,

There are lot of posts in community regarding this, you can check before posting new one.

QlikView Technical Brief - AGGR

QlikView Technical Brief - AGGR.docx

Hope this helps you.

Regards,

Jagan.

robert_mika
Master III
Master III

In few words:

It creates virtual table which can be used to deliver further calculations.

Is doing the same function as Group By in SQL.

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

USE :

The AGGR statement produces a virtual table, with one expression and grouped by one or more dimensions. The contents / result of this virtual table can then be used / aggregated by a further outer aggregation function(s).