Using RangeMax to return only positive numbers

There are occasions where we need to only deal with positive values, such as when we have a chart that will not calculate with negative numbers or when an expression makes no sense having negative numbers.

In this case, we are going to display a block chart for sales, but deal with having negative values. A block chart does not calculate with negative numbers.

Getting ready

Load the following script:

LOAD * INLINE [
  Country, Sales
  USA, 120
  UK, 100
  Mexico, 76
  Canada, 32
  France, 10
  Germany, -5
];

How to do it...

The following steps show you how to use RangeMax to return only positive numbers:

  1. Create a new block chart. Set Country as the dimension.
  2. Add the following expression:
    Sum(Sales)
  3. Click on Finish to save ...

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.