5 Replies Latest reply: Oct 9, 2014 10:11 AM by Antonio Mancini

# Minimum of values not zero

This is probably really easy but I cannot find the function for it. Basically I want to take the minum of all values in my dimension which is not zero.

i.e for the following dataset:

id, value, ....

1, 4800,

2, 3300,

3, 2900,

4, 3000,

5, 0,

6, 4100,

7, 2400

8, 0

9, 2800

I want the expresion to return 2400. This is only for one visualization so I don't want to remove the 0 values in the data load script. I was looking for a "filter" function to filter out all 0 values in the array before applying the Min aggregation but it doesn't seem to exist.

• ###### Re: Minimum of values not zero

Hi Viktor,

You can use Calculated Dimension like

Aggr(If(Sum(Value) > 0,ID),ID)

Regards,

Antonio

• ###### Re: Minimum of values not zero

Thanks for the answer! It takes a little bit getting used to the Qlik script syntax and function names. I'm a bit confused about Aggr. I'm used to thinking functional and was looking for "filter" or "map" functionality. I first thought Aggr is map but looking at the examples is more like SQL group by?

• ###### Re: Minimum of values not zero

Yes Viktor,

Aggr() is Group By.

Aggr(If)) is Group By + where

Regards,

Antonio

• ###### Re: Minimum of values not zero

min({<value={">0"}>}value) should work

• ###### Re: Minimum of values not zero

I hadn't come across the set concept yet. This is what I was looking for, thanks.