Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
dhowland
New Contributor

Question on today() syntax

Good morning.

I'm struggling getting my KPI chart to automatically show data for today only.  If I set up Filters and manually select today it works, or if I hard code in today's date in the expression it works.  I've tried various ways to get today() to work but all I get is either 0, or - as the result.  This is what I have currently and it works correctly: 

count({1<[omdDeliveryDate.autoCalendar.Date] = {'9/27/2018'}>} omdPartID)

I've tried replacing the date with: {today()}.... ${=today()}....and various others but am not getting the results I need.  I don't want the users to have to select the date from the filter panes but rather have the chart update automatically each day.  What am I missing?

Thanks!

Dan

Tags (2)
1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Question on today() syntax

Try it with: count({1<[omdDeliveryDate.autoCalendar.Date] = {'$(=today())'}>} omdPartID) and should your calendar-date have a different formatting to your default date-variable you need to wrap today() with a date(today(), 'YourFormatPattern').

- Marcus

3 Replies
MVP & Luminary
MVP & Luminary

Re: Question on today() syntax

Try it with: count({1<[omdDeliveryDate.autoCalendar.Date] = {'$(=today())'}>} omdPartID) and should your calendar-date have a different formatting to your default date-variable you need to wrap today() with a date(today(), 'YourFormatPattern').

- Marcus

justinphamvn
Contributor II

Re: Question on today() syntax

Hi,

Try this

count({1<[omdDeliveryDate.autoCalendar.Date] = {">=$(=Date(Max([omdDeliveryDate.autoCalendar.Date])))<=$Date(=Max([omdDeliveryDate.autoCalendar.Date]))"}>} omdPartID)

Hope this helps,

Justin.

dhowland
New Contributor

Re: Question on today() syntax

Thanks Marcus.

I swear I tried it that way several times.  I stripped out all my other AND clauses and it worked.  I've added the extras back in one at a time and they are all producing numbers.  They don't match what I show in my ERP system but that will just take some more trial and error to figure out the differences.  Your syntax worked however.