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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
william_allen
Contributor III
Contributor III

Set analysis - field > a date format

Hi All,

I am having an issue with the following expression hopefully someone can help shed a little light on it.

=count({1<[CALL URGENCY]={'Critical'}, [CALL STATE]={'Open'}, [ACTUAL_LOG_DATE]={"<$(vCriticalTime)"}>} [CALL_NUMBER])

The problem is with:  [ACTUAL_LOG_DATE]={"<$(vCriticalTime"}

To explain what's going on a little better:

vCriticalTime = Timestamp(now()-0.1667, 'YYYY-MM-DD hh:mm:ss')

ie vCriticalTime = '2014-07-23 10:46:37 '

The count always comes out as 0 which is wrong.

Can anyone see where I'm going wrong when trying to determine if my vCriticalTime is less than the [ACTUAL_LOG_DATE]?

Thanks for your help

Update fixed the missing ) , still having same issue

21 Replies
annafuksa1
Creator III
Creator III

you are worry about data ? just leave in app like 10 records of data and one graph that you want to work 

if you do not know how :

you need to click at: 'Use advanced editor' and there you can find option 'Attach'

Not applicable

Are you looking to show records that have a [ACTUAL_LOG_DATE] past the current time, is it possible that you don't have such records?

marcus_malinow
Partner - Specialist III
Partner - Specialist III

Try this:

[ACTUAL LOG DATE]={"<$(=vCriticalTime)"}

Note the extra Equals sign

william_allen
Contributor III
Contributor III
Author

The records are there I have checked in the DB, at the minute there are 7 records.

The critical time is current time - 4 hours.

Thanks

william_allen
Contributor III
Contributor III
Author

Thanks Marcus, I tried it no joy

annafuksa1
Creator III
Creator III

Please see my file. I have use Qlikview example data and its working

william_allen
Contributor III
Contributor III
Author

Thanks for taking the time to do that Anna.

The difference between yours and mine seems to be the format of the date.

Your vCriticalTime = Timestamp#(now()-0.1667)

Mine vCriticalTime = Timestamp(now()-0.1667, 'YYYY-MM-DD hh:mm:ss')

Maybe I should convert both Actual Log Date and Critical Time to be numerical.

marcus_malinow
Partner - Specialist III
Partner - Specialist III

Hi William,

It may be that yours is being evaluated as a string rather  than a timestamp. That's the fundamental difference between the timestamp and timestamp# functions.

Marcus

william_allen
Contributor III
Contributor III
Author

OK, so I have tried converting to numerical for ACTUAL_LOG_DATE when loading it to the table:

Num(Date#(ACTUAL_LOG_DATE, 'YYYY-MM-DD hh:mm:ss')) AS ACTUAL_LOG_DATE,

And also converted my vCriticalTime to be numerical like so:

=Timestamp#(now()-0.1667, 'YYYY-MM-DD hh:mm:ss')

But it's still not taking into consideration this part:

[ACTUAL_LOG_DATE]={"<$(vCriticalTime)"}

I'm getting the same result with:

=count({1<[CALL URGENCY]={'Critical'}, [CALL STATE]={'Open'}, [ACTUAL_LOG_DATE]={"<$(vCriticalTime)"}>} [CALL_NUMBER])

AS

=count({1<[CALL URGENCY]={'Critical'}, [CALL STATE]={'Open'}>} [CALL_NUMBER])

Which isn't correct.

I hope that makes sense.

Thanks

annafuksa1
Creator III
Creator III

another difference is here

SET TimestampFormat='YYYY-MM-DD hh:mm:ss[.fff] TT';

please look at my code I comment standard version and put my version