Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

The pos._value of an expression that can be pos. or neg.?

Hi,

I am looking for the QlikView_equivalent of the "mode" we learnt about in school, that is, the pos. value of an expression the result of which can be pos. or neg.

=> Ex.: I have an expression that can result in +4 or -4 - the mode in both cases would be +4 and since my target is "<5", that would be good.

Right now, I do it in a way that is just a little longer, checking whether the output is pos. or neg. and multiplying it with (-1) in case it is neg.

Thanks a lot!

Best regards,

DataNibbler

1 Solution

Accepted Solutions
maxgro
MVP
MVP

3 Replies
maxgro
MVP
MVP

fabs ?

Not applicable

Did you try the mode function?

mode(expression )

Returns the mode value, i.e. the most commonly occurring value, of expression over a number of records, as defined by a group by clause. If more than one value is equally commonly occurring, NULL is returned. Mode can return numeric values as well as text values.

Examples:

Load Month, mode( ErrorNumber ) as MostCommonErrorNumber from abc.csv group by Month;

Load Month, mode( Product ) as ProductMostOftenSold from abc.csv group by Month;

If you want a positive result always just do abs(mode(expression)

datanibbler
Champion
Champion
Author

Great!

That saves me the trouble of writing the whole expression three times - and by that way it also saves on resources by the factor of 3, m.o.l...

Thanks a lot!

Best regards,

DataNibbler