Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
aswinnar
Partner - Contributor III
Partner - Contributor III

Comparing two columns in table

I'm having a requirement where I need to compare two columns within a table: 

 

FIELD1Date
A3/2/16
B2/5/15

 

 

I am needing to provide a visual cue such as a a different background color for 'A' if the date for that field is earlier or later than 'B'. 

 

I'm using the following expression: 

 

if(Field1 = 'A', if(Date > Below(Date),Green(),Red()))

 

however the background color only showing red for me when it should be showing  as green 

 

Is there something that I am doing wrong?

Labels (1)
  • SaaS

4 Replies
Kushal_Chawda

try below

if(Field1 = 'A', if(Date > Below(total Date),Green(),Red()))

aswinnar
Partner - Contributor III
Partner - Contributor III
Author

Yes, that worked. Thanks!

 

I had forgotten to mention that the they were also wanting grey color if the dates are the same. 

 

What would the expression be? 

 

 
 

 

PrashantSangle

add one more if in it try below

 

if(Field1 = 'A', if(Date > Below(total Date),Green(),if(Date<Below(total Date),Red(),grey())))

 

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
aswinnar
Partner - Contributor III
Partner - Contributor III
Author

Hi I tried that, seems that I am still seeing the text turn green when the dates are the same