Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
See why BI users voted Qlik #1 in 11 categories. GET REPORT
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
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
Contributor III
Contributor III

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. 

Highlighted
Partner
Partner

Can you share the screenshot of the expression you used?