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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I make a calculation with Today() in a Set analyses?

I want to count the number of incidences where the datafield ( a date) is BEFORE today. I have tried this

Count({1<Deadline_Date={'<Today()'}>} Deadline_Date)

but it does give me the result

10 Replies
oknotsen
Master III
Master III

Replace

Today()

by

$(=Today())

May you live in interesting times!
Not applicable
Author

Like this?

Count({<Deadline_Date={$(=Today())}>} Deadline_Date)

It does not work. I want to count the number of dates BEFORE "today"

jyothish8807
Master II
Master II

Hi Soren,

Try like this:

Count({<Deadline_Date={'< $(=Today())'}>} Deadline_Date)

Note:Make sure the format of Deadline _date and today() should be in same format eg both DD/MM/YYYY

Regards

KC

Best Regards,
KC
Not applicable
Author

Deadline_Date is 22-07-2016 15:00:00

Where do I see the Today() format ?

In the script header?

SET TimeFormat='hh:mm:ss';

SET DateFormat='DD-MM-YYYY';

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

and how do I "align" the formats for DD/MM/YYYY ?

sunny_talwar

You might need to add Date() function as well, in addition to what have been mentioned above:

Count({1<Deadline_Date={"$(='<' & Date(Today(), 'DateFieldFormatHere'))"}>} IncidentID)

Anonymous
Not applicable
Author

Hi,

A little improvement from Sunny:

And pls note you need use double quote to identify it will filter/search for the matching results. single quote is for string with 100% match.

COUNT({<Deadline_Date={"<$(=Date(today(),'DD-MM-YYYY'))"}>}IncidentID)

Format 'DD-MM-YYYY' is an example, you must match this format with your Deadline_Date column.

Zhihong

sunny_talwar

May be make a slight modification in the script:

Date(Floor(Deadline_Date)) as Deadline_Date,

Deadline_Date as Deadline_DateTime

and then try this:

Count({1<Deadline_Date={"$(='<' & Date(Today()))"}>} IncidentID)

idogridish2
Creator III
Creator III

Hi,

You can try

COUNT({$<Deadline_Date={'<$(=Num(Today()))'}>}IncidentID)

oknotsen
Master III
Master III

I did not say "remove the < or the quotes" .

May you live in interesting times!