Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Is it possible to create an if in which a variable is compared with the maximum value that variable can take?

I want to create ranges of colors using an expression and I want to do it by dividing the range in equal amplitudes (min-max / 3, max / 3-max * 2/3 and max * 2/3-max)

The problem I have is that when I want to set the ranges, it puts as if all the values are in the highest range.

The expression I am using is the following:

= If ($ (vShareClientsZC) <Max (Aggr (Count (distinct ClientId) / sum (HomesxMzna), AppleKey)) / 3, '# ff0b05',

If ($ (vShareClientsZC) <Max (Aggr (Count (distinct ClientId) / sum (HomesxMzna), AppleKey)) * 2/3, '# ffff05',

if (IsNull ($ (vShareClientesZC)), '# ff0b05', '# 40ff00')))

What I think is happening is that Qlik is comparing each share with the same share value divided 3, etc ... It is not comparing it with the max value of share of all the rows.

Does anybody know how I can fix it?


Thank you very much in advance.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I am missing some context, i.e. where are you using this expression, what's the definition of your variable.

Maybe add a TOTAL qualifier to your max() outer aggregation:

Max (TOTAL  Aggr (Count (distinct ClientId) / sum (HomesxMzna), AppleKey))

View solution in original post

2 Replies
swuehl
MVP
MVP

I am missing some context, i.e. where are you using this expression, what's the definition of your variable.

Maybe add a TOTAL qualifier to your max() outer aggregation:

Max (TOTAL  Aggr (Count (distinct ClientId) / sum (HomesxMzna), AppleKey))

Anonymous
Not applicable
Author

It worked!


Thanks a lot...