Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
NenadV
Creator
Creator

How to set a different background color based on value comparison with the row above

in Qlikview please:

For example, if the value in the 2nd row is lower than in the row above to be colored in green.

2024-04-23_14-16-27.jpg

 

Thank you

Labels (2)
22 Replies
NenadV
Creator
Creator
Author

That doesn't make sense. Why such a basic and simple function does not work.

It' bout only comparing values in two consecutive lines and coloring it differently to emphasize it?

Is it possible that this only doesn't work in QlikView? 

NenadV
Creator
Creator
Author

Straight table with  plain cost numbers. Nothing fancy!

marcus_sommer

Of course it will work - if not anything is wrong with your expressions. Like above mentioned make sure that they are working and not returning NULL like in your example screenshot. Here a quick check with my data:

marcus_sommer_0-1714042352568.png

 

NenadV
Creator
Creator
Author

Why this works only if you have up to and including 2 dimensions?

2024-04-25_13-24-50.jpg

marcus_sommer

If there are multiple dimensions you may need a TOTAL statement with the above() and/or also wrapping the above() with an aggr(). At first implement the interrecord-logic directly in the chart to see if it returned valid and the expected values for each cell - and then a color-comparing within the attribute-expressions should be also working. 

NenadV
Creator
Creator
Author

Thanks Marcus. In this simple request there is nothing to sum up, it is only to show if the value in one row is different from the value in the row just above. Can't be simpler 

marcus_sommer

That's never true - because everything is and must be an aggregation and if none is explicitly applied Qlik takes only() and as far as if there is more as single value available the result will be NULL.

The Aggregation Scope - Qlik Community - 1467321 

NenadV
Creator
Creator
Author

Then, if there is nothing to sum up  and if there is only one value per line/row using the max() function should be ok. Correct?

NenadV
Creator
Creator
Author

and it doesn't work with more than 2 dimensions 😞

2024-04-25_14-54-22.jpg

 

Text Color if(max(X) > above(max(X)), lightred())

marcus_sommer

Skip at first the condition and apply these 3 expressions:

max(X)
above(max(X))
above(TOTAL max(X))

does they return always they expected values?