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:
Create a new block chart. Set Country as the dimension.
Add the following expression:
Sum(Sales)
Click on Finish to save the chart:
Edit the properties of the chart and change the expression to the following:
RangeMax(Sum(Sales), 0)
Confirm that the chart now displays the data. There should be no block for Germany as it was the negative value.