Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
WE ARE LISTENING! New Navigation for Qlik Community, Sept. 26: TELL ME MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
juanpi44
Contributor II
Contributor II

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

juanpi44
Contributor II
Contributor II
Author

It worked!


Thanks a lot...