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: 
QFanatic
Creator
Creator

Assistance with Expression

Hello all

I am having trouble with an expression.

In my model I have a field INCIDENTOPENINGDATE which contains '2019/01/01' - it is a true date field (if I change the display format to Integer, it gives me a true date value - etc 43191)

In my expression I want to display everything that is LESS or EQUAL TO a variable - the variable is called vPrevDate and contains '2019/11/11'

My Expression currently is this...

=count({<INCIDENTOPENINGDATE ={"$(='$(vPrevDate)')"}>}distinct INC_INCIDENT_ID) and it works fine for = to, but NOT less than (obviously)

 

How do I change my expression to do the LESS than as well?

Unfortunately I cannot post a copy of the model, it is work related.

 

Thanks 

1 Solution

Accepted Solutions
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

The script with dummy data:

SET DateFormat='YYYY/MM/DD';

SET vPrevDate = '2019/11/15';

tmp:
LOAD Chr( Floor(rand() * 26) + 65) as INC_INCIDENT_ID,
Date(today() + rowno()) as INCIDENTOPENINGDATE
AutoGenerate 1000;

The xpression:

=Count({<INCIDENTOPENINGDATE = {"<=$(vPrevDate)"}>}DISTINCT INC_INCIDENT_ID)

And the result in the picture:

Screenshot_1.png

View solution in original post

5 Replies
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Try this:

count({<INCIDENTOPENINGDATE ={"<=$(='$(vPrevDate)')"}>}distinct INC_INCIDENT_ID) and it works fine for = to, but NOT less than (obviously)

QFanatic
Creator
Creator
Author

It returns this...(see Attachment)

Arthur_Fong
Partner - Specialist III
Partner - Specialist III

You have a sample app?

QFanatic
Creator
Creator
Author

I do but I am not allowed to post it, as it is work related.
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

The script with dummy data:

SET DateFormat='YYYY/MM/DD';

SET vPrevDate = '2019/11/15';

tmp:
LOAD Chr( Floor(rand() * 26) + 65) as INC_INCIDENT_ID,
Date(today() + rowno()) as INCIDENTOPENINGDATE
AutoGenerate 1000;

The xpression:

=Count({<INCIDENTOPENINGDATE = {"<=$(vPrevDate)"}>}DISTINCT INC_INCIDENT_ID)

And the result in the picture:

Screenshot_1.png