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: 
Not applicable

Expression syntax

Hi,

I want to get the count of ids where the difference between two dates is greater than 30.  Please help me with the syntax.

Capture.JPG

Thanks,

Sudha.

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

I think this works for you:

2015-10-05 #1.PNG

View solution in original post

13 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try something like this: count({<UPDATE_DT={"<$(=Today()-30)"}>} distinct CASE_ID)

If that doesn't work please post a small qlikview document that demonstrates the problem so we can find out what will work correctly with your data.


talk is cheap, supply exceeds demand
petter
Partner - Champion III
Partner - Champion III

Count( { <CASE_ID={"=Now()-Update_DT>30"}> } CASE_ID )

maybe even with DISTINCT

Count( DISTINCT { <CASE_ID={"=Now()-Update_DT>30"}> } CASE_ID )

markgraham123
Specialist
Specialist

Gysbert and Petter were right.

other way is using the If condition,

=Count(If((Date(Now())-Date(UPDATE_DT)) > 30, CASE_ID)

or Distinct:

=Count(Distinct(If((Date(Now())-Date(UPDATE_DT)) > 30, CASE_ID))

petter
Partner - Champion III
Partner - Champion III

The solution that Gysbert and I recommend is using a so-called Set Expression.

The set which is enclosed in curly braces { and } defines which subset of rows that should be used in the Count.

Furthermore the angle brackets < and > enclosed a set modifier that works as a where. So it says that the field mentioned CASE_ID (in my suggestion) should be based on the search condition which is enclosed in double quotation marks and starts with an equal sign. The search is then for rows where the difference between now and Update_DT is greater than 30.

Not applicable
Author

Thanks for the help and the great explanation on the syntax.

Could you please check what I am missing -

None of the above syntax is producing the result.  I don't see any error in the editor but it just outputs 0 everywhere.

Capture.JPG

Thanks,

Sudha.

maxgro
MVP
MVP

maybe

count({<UPDATE_DT={"<$(=Date(Today()-30))"}>} distinct CASE_ID)

see attachment

Not applicable
Author

Hi,

Please let me know how to attach a qvw file.  The attachment option I see here accepts only urls.  Is there a way to choose a file from my local and attach it here?

Thanks,

Sudha.

maxgro
MVP
MVP

reply

use advanced editor (top right)

attach (bottom right)

Not applicable
Author

Thank you!

I have the QVW here.  Please have a look.  It's only displaying zeros.