Skip to main content Skip to complementary content

Nested aggregations

You may come across situations where you need to apply an aggregation to the result of another aggregation. This is referred to as nesting aggregations.

As a general rule, it is not allowed to nest aggregations in a QlikView chart expression. Nesting is only allowed if you:

  • Use the TOTAL qualifier in the inner aggregation function.
Information note No more than 100 levels of nesting is allowed.

Nested aggregations with the TOTAL qualifier


You want to calculate the sum of the field Sales, but only include transactions with an OrderDate equal to the last year. The last year can be obtained via the aggregation function Max(TOTAL Year(OrderDate)).

The following aggregation would return the desired result:

Sum(If(Year(OrderDate)=Max(TOTAL Year(OrderDate)), Sales))

The inclusion of the TOTAL qualifier is absolutely necessary for this kind of nesting to be accepted by QlikView, but then again also necessary for the desired comparison. This type of nesting need is quite common and is a good practice.

Learn more


Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: