Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
jpjust
Specialist
Specialist

Background Color Expression

Hi,

I have the table below.

Publish Time is directly coming from the script as AppPublishTime

Expression for Checked Time  =timestamp(max(total<PublishedAppName>createdDateTime))

Now,  I have an background color expression on Checked Time field.   =if(timestamp(max(total<PublishedAppName>createdDateTime)) < [AppPublishTime]-1 ,yellow ())

If Checked time is less than AppPublishtime -1 then highlight as yellow which works great.

What I additionally want is

Highlight as Orange if  Checked time is less than AppPublishtime -5

Highlight as Red if Checked time has - (dash)

Highlight as green if date of checked time and date of Publish time are same

I tried using various expression but other than the expression for yellow condition, nothing else seems to be working.

Please let me know if there is an good way of incorporating the above conditions into background color for the Checked Time field. Thanks very much!!

jpjust_0-1642619638170.png

 

3 Replies
chris_djih
Creator III
Creator III

Can you please show the what you tried in the first place?
In case you used nested if conditions, in most cases it is very important which statement comes first:
When you test "if date < yesterday" first, it will will be true for any date before yesterday.
if you want to test for "date < last week" this has to be tested before "date < yesterday"

hope, this hint helps. if not, please paste the script which is not working so we can fix it.

If you found help, mark the correct answer and give some likes to ALL contributors, that tried to help.
jpjust
Specialist
Specialist
Author

Thanks, that hint worked.

Now the issue is, the last IF statement don't work

=if(timestamp(max(total<PublishedAppName>createdDateTime)) < [AppPublishTime]-5 ,rgb(255,0,0), if(timestamp(max(total<PublishedAppName>createdDateTime)) < [AppPublishTime]-1 ,yellow(),if(date(max(total<PublishedAppName>createdDateTime)) < date([AppPublishTime]) ,green(),IF(timestamp(max(total<PublishedAppName>createdDateTime)) ='-',red())) ))

For the last IF statement, I tried using If(ISNULL, IF(LEN, but nothing works.

Here is my output from the above nested IF expression.

jpjust_0-1642686726403.png

 

chris_djih
Creator III
Creator III

This is more or less intendet. Null values will always show as gray.
Only solution is you generate a custom "null vlaue" in the script, for example  Analyszed Time "unkown" when ever there is no data for this field.

If you found help, mark the correct answer and give some likes to ALL contributors, that tried to help.