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

Monthly comparison with RAG colours

Hi all

I'm trying to code a vertical bar chart that compares the latest month's score with the previous month and colours the latest month's bar Red or Green.

The problem I'm getting is that IF statement I'm using to change the 'Background Colour' attribute in the expression isn't splitting by dimension, but instead taking a sum of the whole data set.

Capture.JPG

Here's the expression I'm using:

=if(

Sum({$<Area={'Overall'}, Month={$(=Max(Month))}>} Score) < Sum({$<Area={'Overall'}, Month={$(=Max(Month)-1)}>} Score),

lightred(), green())


  • The X-axis are a list of companies
  • Month is a number 1 - 12
  • Score is... well... the score

Where am I going wrong guys?

Thanks in advance

Lewis

1 Reply
prieper
Master II
Master II

would be nice to have some sample data...

Does the code deliver the correct results (select for one company and copy sniplets only, i.e.

Sum({$<Area={'Overall'}, Month={$(=Max(Month))}>} Score) should deliver correct results,

likewise

Sum({$<Area={'Overall'}, Month={$(=Max(Month)-1)}>} Score)


Peter