Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare values to each other in a chart

I have a chart with the dimension Year and Expression Sum(Profit).

How do I write an expression to check if the profit for one year has increased or decrease since last year?

In other words, profit Year X is larger than profit Year X-1. I know it's possible to call the variable Year but not how to compare it with another Year variable...

4 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

use function above() to get the previous value - if you chart dimension is "Year", then the previous value will be the value from the previous Year.

Not applicable
Author

Hi Oleg,

This does indeed work, but for me sometimes it does not...

Attached I created an example for which the above function only displays a '-' ...

Very strange... but probably for a reason 🙂

Regards,

Maarten

pat_agen
Specialist
Specialist

hi,

this is because you are using several dimensions in your charts.

In this case you must use the function above() with the qualifier TOTAL. like this

above(total aValue)

Not applicable
Author

Hi,

Thanks! That did indeed fix it!

10Q!

Have great day!

Maarten