Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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
Honored Contributor III

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

Replace

Today()

by

$(=Today())

May you live in interesting times!
Not applicable

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

Like this?

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

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

jyothish8807
Honored Contributor II

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

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

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

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 ?

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

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)

geminihzh
Valued Contributor

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

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

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

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
Contributor II

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

Hi,

You can try

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

oknotsen
Honored Contributor III

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

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

May you live in interesting times!
Community Browser