Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Qlik_FZ
Partner - Creator
Partner - Creator

Interval with if condition

Hi,

unable to use IF condition on below expression in table.

 

Interval(Timestamp(aggr(MAX(A_DATE),REQ_ID))-Timestamp(aggr(Min(T_DATE),R_ID)),'hh')

 

for example -

if the result of the expression is 170 hours then i want to apply if condition as below 

IF(Interval(Timestamp(aggr(MAX(ACTION_DATE),REQ_ID))-Timestamp(aggr(Min(TRANS_DATE),REQ_ID)),'hh')<=170,'True','False') but its not returning me result.

Labels (1)
5 Replies
tresesco
MVP
MVP

Interval() is a formatting function, i.e. - it doesn't change the value internally. In other words, if interval() shows you 1 from 'hh' formatting that is not actually 1 that you can compare. You can use hour() to extract the hour number from a timestamp.

Qlik_FZ
Partner - Creator
Partner - Creator
Author

Hi Tresesco,

Thank you for response.

kindly help me with above expression with hour

tresesco
MVP
MVP

Well, since your timestamp difference could go beyond 1 day, hour() might not suit here. Try like:

If ((Timestamp(aggr(MAX(A_DATE),REQ_ID))-Timestamp(aggr(Min(T_DATE),R_ID)) )*24 <=170, 'True', 'False')

Qlik_FZ
Partner - Creator
Partner - Creator
Author

This is not returning correct result

tresesco
MVP
MVP

The issue could be somewhere else, like your aggr(), chart dimensions or the timestamp field value type... Try to share a sample app with data set explaining the expected output; then we could have a look to fix the issue