Using AGGR to resolve a "Sum of Rows" issue

"Sum of Rows" issues are reasonably rare. Essentially, what it means is that the sum that is displayed as the total on a table is not actually the sum of the rows displayed in the table (usually discovered when exporting to Excel), or the total is not calculated at all. Often, it can be the result of a complicated if statement in the expression, or from using values from across different tables in the expression.

In this recipe, we will look at a very simple example and see how to resolve it using AGGR.

Getting ready

Load the following script:

// Load Sales data Sales: LOAD * INLINE [ Country, Month, Curr, ProdID, Price, Qty USA, 2013-01-01, USD, 1, 1.99, 2 USA, 2013-02-01, USD, 2, 2.99, 3 USA, 2013-03-01, ...

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.