Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to set a Background Color expression by date. I want it to show green if within a year of the Aggr(max(LAST_INSPECTION_DATE),TRAILER) or Red if greater than a year of the Aggr(max(LAST_INSPECTION_DATE),TRAILER).
I have
IF(Year(Aggr(max(LAST_INSPECTION_DATE),TRAILER)) > AddYears(Aggr(max(LAST_INSPECTION_DATE),TRAILER),1), LightRed(),Green())
And I get this all green
@QlikSenseUser2 try below. Make sure that you are using below same expression on correct column. If this still did not work share the sample qvf file
=if(LAST_INSPECTION_DATE > addyears(Today(),-1) and LAST_INSPECTION_DATE <= Today(), Green(),Red())
are you looking for the moving 1 year date or the current year to date ?
Moving 1-year date. I would like for it to go by the Last Inspection Date.
You can try something this?
IF(Year(LAST_INSPECTION_DATE) = (Year(LAST_INSPECTION_DATE)+1), LightRed(),Green())
It's still showing all green
@QlikSenseUser2 so let's say last_inspection_date is "17-Jul-2021", so which dates should be green and which one should red? You can specify ranges to be clear
17-Jul-2020 and before should be Red everything else Green
@QlikSenseUser2 then below should work
= if( LAST_INSPECTION_DATE > addyears(max(total LAST_INSPECTION_DATE),-1), Green(),red())
It's now showing all Red
@QlikSenseUser2 Not sure but it's working fine for me. see the below. "15-Jul-2021" is latest date. Make sure that your LAST_INSPECTION_DATE is in proper Date format. To check that use max(LAST_INSPECTION_DATE) in KPI object, if it returns value then it's fine else there is format issue. In that case you need to first convert that field to proper date format