Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

ndeeleysww
Contributor

problems with date variable in set analysis

Hi there,

I've created a variable in using the variables interface to display todays date minus 30 days, called vToday:

Image1.png

When I output this variable to a text box there's no problem displaying the date (tho I need to format it to see the date rather than the numerical value of the date:

image2.png

However, when I try to use this variable in set analysis, QlikSense displays no results. A hard coded date does:

image3.png

The syntax I am using is:

count({$<Date={'>=22/02/2016'}>} AlarmCount)

count({$<Date={'>=$(vTodaysDate)'}>} AlarmCount)


In the data load editor my date format is set to SET DateFormat='DD/MM/YYYY'


It must be the formatting of the date in the variable, but I have tried date(Today()-30, 'DD/MM/YYYY') and there is no difference.


It's driving me mad...any help greatfully received.


Cheers

Neil

1 Solution

Accepted Solutions

Re: problems with date variable in set analysis

Can you try this:

Count({$<Date={'>=$(=$(vTodaysDate))'}>} AlarmCount)

or

Count({$<Date={'>=$(=Date($(vTodaysDate)))'}>} AlarmCount)

3 Replies

Re: problems with date variable in set analysis

Can you try this:

Count({$<Date={'>=$(=$(vTodaysDate))'}>} AlarmCount)

or

Count({$<Date={'>=$(=Date($(vTodaysDate)))'}>} AlarmCount)

ndeeleysww
Contributor

Re: problems with date variable in set analysis

Thanks Sunny, that worked.

But what was interesting is this:

The first expression

Count({$<Date={'>=$(=$(vTodaysDate))'}>} AlarmCount)

Only worked where I had created my variable with formatting:

The second expression

Count({$<Date={'>=$(=Date($(vTodaysDate)))'}>} AlarmCount)

Still worked if my variable had both date formatting and no date formatting: Today()-30 or date(Today()-30, ‘DD/MM/YYYY’)

Date are something I feel Qlik Sense still doesn’t quite get right in variables.

Re: problems with date variable in set analysis

Not sure but may be adding a equal sign within your variable might make a difference. One of those things, I am never comfortable with (variables)

Community Browser