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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
surajap123
Creator III
Creator III

Why Aggr() in straight and pivot table?

Hi All,

I always have this doubt about why to use Aggr(which is group by in sql) in straight table and pivot table.

As far as i know the straight table or pivot table will group the expression result(say, sum(sales)) automatically based on the dimension used.

So ultimately, the row in the straight/pivot table will have the aggregated value beside its corresponding dimension.

So why to use aggr?

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

You are absolutely right. Aggr() should usually NOT be used.

However, if you want a nested aggregation, then you should use Aggr(), e.g.

Average of (Sum of sales per Month) = Avg(Aggr(Sum(Sales),Month))

HIC

See also

http://community.qlik.com/blogs/qlikviewdesignblog/2013/03/11/when-should-the-aggr-function-not-be-u...

http://community.qlik.com/blogs/qlikviewdesignblog/2014/05/19/function-classes

View solution in original post

3 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Aggr can aggregate values on dimension different from the one used in the chart ...

hic
Former Employee
Former Employee

You are absolutely right. Aggr() should usually NOT be used.

However, if you want a nested aggregation, then you should use Aggr(), e.g.

Average of (Sum of sales per Month) = Avg(Aggr(Sum(Sales),Month))

HIC

See also

http://community.qlik.com/blogs/qlikviewdesignblog/2013/03/11/when-should-the-aggr-function-not-be-u...

http://community.qlik.com/blogs/qlikviewdesignblog/2014/05/19/function-classes

surajap123
Creator III
Creator III
Author

Thanks!!..you guys cleared my doubt.