Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggr Function

Hi everybody,

Can anyone explain the aggr function with example, more than what is mentioned in reference manual?

Thanks and regards,

Murali

1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Hi,

Aggr() functions is used when you are counting or sum up by a particular field(s).

Suppose

Dept     EmpID    

Sales     101

Sales     102

Sales     102

Sales     103

Market    104

Market    101

Suppose if we want to get the count of Distinct employees by department

If you use Count(Distinct EmpID) then you will get the value as 4.

But if you use Aggr for getting Distinct Employee by department

then we have use

=Sum(Aggr(Count(Distinct EmpID), Dept)) Now you will the get the value as 5.  For Sales Dept there are 3 and for Market 2 by summing up all this becomes 5.

This is one of the sample scenario for using AGGR().

Hope this helps you.

Regards,

Jagan.

View solution in original post

2 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

Aggr() functions is used when you are counting or sum up by a particular field(s).

Suppose

Dept     EmpID    

Sales     101

Sales     102

Sales     102

Sales     103

Market    104

Market    101

Suppose if we want to get the count of Distinct employees by department

If you use Count(Distinct EmpID) then you will get the value as 4.

But if you use Aggr for getting Distinct Employee by department

then we have use

=Sum(Aggr(Count(Distinct EmpID), Dept)) Now you will the get the value as 5.  For Sales Dept there are 3 and for Market 2 by summing up all this becomes 5.

This is one of the sample scenario for using AGGR().

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Thanks Jagan