Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
ndeeleysww
Creator
Creator

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
sunny_talwar

Can you try this:

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

or

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

View solution in original post

4 Replies
sunny_talwar

Can you try this:

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

or

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

View solution in original post

ndeeleysww
Creator
Creator
Author

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.

sunny_talwar

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)

raffaeleg
Contributor II
Contributor II

Thanks @sunny_talwar  that worked for me, but the syntax with variables is not very easy.