Skip to main content
Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Background color

Hi i have two date fields..

Sno                    Start Date                                         End_Date                         Duration

  1            12-sep-2016 12:00:32 AM               12-sep-2016 12:00:52 AM               00 hr : 00 min : 20 sec

  2            12-sep-2016 02:20:02 PM               13-sep-2016 02:20:02 PM               24 hr : 00 min : 00 sec

  3            13-sep-2016 06:20:02 PM               13-sep-2016 08:20:02 PM               02 hr : 00 min : 00 sec

  4            13-sep-2016 06:20:02 AM               13-sep-2016 10:20:02 PM               16 hr : 00 min : 00 sec

Here, i want to display the background color as yellow which as duration of more than >10 hr between two given dates and  Green color for the duration < 10 hr

Thanks..

1 Solution

Accepted Solutions
Digvijay_Singh

Try this out -

script -

Duration expression -

only(Interval([End Date]-[Start Date],'hh:mm:ss TT'))


Background expression -

if(Duration>10/24,Yellow(),LightGreen())


Script

Load Sno,

  Timestamp#([Start Date],'DD-MMM-YYYY hh:mm:ss TT') as [Start Date],

  Timestamp#([End_Date],'DD-MMM-YYYY hh:mm:ss TT') as [End Date]

Inline [

Sno ,                  Start Date  ,                                      End_Date  

  1    ,        12-sep-2016 12:00:32 AM    ,          12-sep-2016 12:00:52 AM          

  2  ,          12-sep-2016 02:20:02 PM  ,            13-sep-2016 02:20:02 PM        

  3  ,          13-sep-2016 06:20:02 PM  ,            13-sep-2016 08:20:02 PM        

  4  ,        13-sep-2016 06:20:02 AM  ,            13-sep-2016 10:20:02 PM  ];

Capture.JPG

View solution in original post

5 Replies
Anil_Babu_Samineni

Perhaps This

=If([Start Date] >= If(Match(Hour(Duration),'10 hr'),Duration),Yellow(),Green())

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

No.. this is not working.. i am getting green color background fr all the rows..

Anil_Babu_Samineni

Can you please post the application

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Digvijay_Singh

Try this out -

script -

Duration expression -

only(Interval([End Date]-[Start Date],'hh:mm:ss TT'))


Background expression -

if(Duration>10/24,Yellow(),LightGreen())


Script

Load Sno,

  Timestamp#([Start Date],'DD-MMM-YYYY hh:mm:ss TT') as [Start Date],

  Timestamp#([End_Date],'DD-MMM-YYYY hh:mm:ss TT') as [End Date]

Inline [

Sno ,                  Start Date  ,                                      End_Date  

  1    ,        12-sep-2016 12:00:32 AM    ,          12-sep-2016 12:00:52 AM          

  2  ,          12-sep-2016 02:20:02 PM  ,            13-sep-2016 02:20:02 PM        

  3  ,          13-sep-2016 06:20:02 PM  ,            13-sep-2016 08:20:02 PM        

  4  ,        13-sep-2016 06:20:02 AM  ,            13-sep-2016 10:20:02 PM  ];

Capture.JPG

Anonymous
Not applicable
Author

Thanks all for ur help