Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

gkcchowdary
Contributor

what is aggr function

Explain aggr function

5 Replies
qlikviewnovice
Valued Contributor II

Re: what is aggr function

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))

qlikviewnovice
Valued Contributor II

Re: what is aggr function

MVP
MVP

Re: what is aggr function

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.

Re: what is aggr function

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
Valued Contributor II

Re: what is aggr function

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).

Community Browser