
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
what is the use of aggr()?
what is the use of aggr()?
- Tags:
- new_to_qlikview


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
It's a special function for advanced aggregation.
Like group by for your calculations
Aggr(sum(Sales), Manager, Region) - makes aggregation of Sales by Manager and Region
Regards,
Andrei


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check in Qlikview Help
Aggr
There is a
special function for advanced aggregations:
aggr ([ distinct | nodistinct ]
[{set_expression}]expression {, dimension})
Returns a set of values of expression calculated
over dimensions. The result can be
compared to the expression column of a 'local chart', evaluated in the context
where the aggr function resides. Each dimension must be a single field. It cannot be an expression
(calculated dimension).
If the expression argument is preceded by the nodistinct qualifier, each combination of dimension values may
generate more than one return value, depending on underlying data structure. If
the expression argument is preceded by the distinct qualifier or if no qualifier is used at all, each
combination of dimension values will generate only one return value.
By default, the aggregation function
will aggregate over the set of possible records defined by the selection. An
alternative set of records can be defined by a Set Analysis expression.
By using this function in Add calculated
dimension... it is possible to achieve nested chart aggregation in
multiple levels. See also Nested Aggregations and
Related Issues.
When used in chart expressions it is
possible to achieve Sum of
Rows in Pivot Tables.
Examples:
aggr(
sum(Sales), Country )
aggr(
nodistinct sum(Sales), Country )
aggr(
sum(Sales), Country, Region )
count( aggr( sum(Sales), Country ))
You can also check

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Take a look at these links:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works just like a Group by in SQL. Try help and reference manual, you'd get a clear idea on this.
- AD

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Harish,
The aggr() function used to show the aggregated value of the MEASURE field with a DIMENSION field.
Kind regards,
Ishfaque Ahmed

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the question is in contrast what's the difference using the aggr() function vs plain ol' pivot table.
The difference is you can calculate a sum() at a higher leaf while drilling further - so to summaraize at a certain level in other words - as an example:
aggr(sum([Profits]),[Year], [Month])
| Agg | Profits |
----------------------------------------
-YYYY | - | 5 |
+MM1 | 5 | 3 |
+MM2 | - | 2 |
(crudely shown)
Play with it is the best advice now.
