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

Colour Expression

Hi,

I have the following calculation (below) which is doing what I need it to, but I want my KPI color to change dependent on whether the number is a positive or negative. 

If positive, I want the number to be Green, if Negative, then Red. Any idea how I would do this please?

(sum({$<Year={'2020'}>} [sales]) - sum({$<Year={'2019'}>} [sales]))

/

sum({$<Year={'2019'}>} [sales])

3 Replies
Vegar
MVP
MVP

IF( ((sum({$<Year={'2020'}>} [sales])-sum({$<Year={'2019'}>} [sales]))/sum({$<Year={'2019'}>} [sales]))<0,
  red(),
  green()
)

thomas_2583
Contributor III
Contributor III
Author

thanks for the suggestion, but it doesn't seem to work. Regardless on whether the KPI number is a positive or negative, the colour stays Red. 

shraddha_g
Partner - Master III
Partner - Master III

Can you share the screenshot of the expression you used?