Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
juanpi44
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
Not applicable

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

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))

2 Replies
swuehl
Not applicable

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

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))

juanpi44
Not applicable

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

It worked!


Thanks a lot...