Using AGGR to calculate the percentage of the maximum value

AGGR is the function that we will use to perform vertical calculations.

In this case, we are going to work out which country has the highest value, and calculate the percentage of other sales versus that highest value.

Getting ready

Load the following script:

LOAD * INLINE [
  Country, City, Sales
  USA, San Diego, 24567
  USA, Dallas, 54962
  USA, New York, 67013
  USA, Boston, 45824
  UK, London, 64002
  UK, Birmingham, 44291
  UK, Manchester, 40320
  Germany, Berlin, 52912
  Germany, Frankfurt, 61832
  Germany, Munich, 35812
  Japan, Tokyo, 42137
  Japan, Yokohama, 55832
  Japan, Osaka, 37643
];

How to do it...

Use the following steps to use AGGR to calculate the percentage of the maximum:

  1. Create a new straight table ...

Get QlikView for Developers Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.