Using nested aggregations
We know how to use several aggregation functions such as sum
, max
, min
, and avg
. When used in a measure of a chart or table, they aggregate values over the dimension stated in that chart or table.
Sometimes, you need to create a second aggregation based on the result of the first. An example could be the value and the name of the country with the most customers. This can be done using Aggr
, combined with the Max()
and Firstsortedvalue()
functions.
Getting ready
Create a new Qlik Sense application, and load the following script that gives information on sales per country:
LOAD * INLINE [ Region, Country, No of Customers, Sales Americas, Uruguay, 200, 56000 Europe, France, 900, 252000 Americas, Brazil, 1500, 330000 Europe, Croatia, 500, 160000 Americas, Mexico, 1800, 122000 Americas, Argentina, 1200, 360000 Europe, Portugal, 1100, 302500 Europe, Spain, 800, 250000 Europe, Denmark, 1500, 435000 Europe, Belgium, 700, 154000 Asia, China, 2000, 370000 Asia, Japan...