Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
athinadev
Partner - Contributor II
Partner - Contributor II

Qlik Sense, Set Text color expression by comparing columns using Above()

Hello,

I have this table, and I want to show the data in a table and based on the Type, I want to set a Text color expression

LOAD * INLINE [Id, Type,ModelName, ActivationTime, Value
1, 0, 'Alpha', 2019-01-01 12:35:22.400, 0
2, 0, 'Alpha', 2019-01-01 12:35:22.600, 0
3, 0, 'Beta',  2019-01-01 12:35:22.600, 0
4, 0, 'Beta',  2019-01-01 12:35:22.600, 1

5, 1, 'Alpha', 2019-01-01 12:35:22.400, 0
6, 2, 'Beta',  2019-01-01 12:35:22.400, 0

7, 1, 'Alpha', 2019-01-01 12:35:22.500, 0
8, 2, 'Alpha', 2019-01-01 12:35:22.600, 0

9, 1, 'Alpha', 2019-01-01 12:35:22.700, 0
10, 2, 'Alpha', 2019-01-01 12:35:22.700, 1
];

 

If Type=2, I want to compare the column value with the previous row and if there are not equal then I want to set a different color. I am using this condition for the columns ModelName, ActivationTime, Value

 

=IF(Type=1, RGB(0,0,255), IF(Type=2, IF(ModelName<>Above(ModelName,1), RGB(255,0,0))))

=IF(Type=1, RGB(0,0,255), IF(Type=2, IF(ActivationTime<>Above(ActivationTime,1), RGB(255,0,0))))

=IF(Type=1, RGB(0,0,255), IF(Type=2, IF(Value<>Above(Value,1), RGB(255,0,0))))

 

The problem is, that even if the values are equal, I get the red color for each column,row with Type 2

What am I doing wrong?

Colors.PNG

 

Labels (2)
1 Solution

Accepted Solutions
athinadev
Partner - Contributor II
Partner - Contributor II
Author

Unfortunately it didn't work.

The solution is to use the verb total

 

IF(xxx<>Above(Total(xxx),1)

View solution in original post

4 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Use only one dimension and add all other as Expression and it will work.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
athinadev
Partner - Contributor II
Partner - Contributor II
Author

Thank you for the fast reaction.

 

I am new in Qlik Sense.

What do you mean exactly with 'Use only one dimension and add all other as Expression'

 

BR

athinadev

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

What I mean by that is when you add table, just add one dimension (i.e ID in your case).

Rest all should be added as expression.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
athinadev
Partner - Contributor II
Partner - Contributor II
Author

Unfortunately it didn't work.

The solution is to use the verb total

 

IF(xxx<>Above(Total(xxx),1)