Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

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
Highlighted
Partner
Partner

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

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Highlighted
Creator
Creator

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. 

Partner
Partner

Can you share the screenshot of the expression you used?