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:
Create a new straight table with Country and City as dimensions.
Add the following expressions:
Sales $
Sum(Sales)
% of Max
Sum(Sales) /
Max(TOTAL Aggr(Sum(Sales), Country, City))
On the Expression tab, for the second expression, under...