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

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

Problem when using date

Hi ,

I have a problem when using date.
I explain. I have two fields (DATE_VALIDATION and CALENDAR.DATE) which contain date values in the format 'YYYY-MM-DD'

I want to create a field which contains values from DATE_VALIDATION for the last 6 months from a certain date selected in CALENDAR.DATE.

For that I create two variables : last6month = addmonths(monthend(max(CALENDAR.DATE))+1,-6) and maxDate= max(CALENDAR.DATE).

I then created a selection which has the following expression : if(DATE_VALIDATION >= $(last6month) and DATE_VALIDATION <= $(maxDate),DATE_VALIDATION)

But the selection list shows me no values.

Someone can explain it ?

4 Replies
PrashantSangle

Hi,

When you use max()

that time your date field is converted to num format

therefore You have convert your Date_validation field in Num format then compare.

Do like this

if(DATE_VALIDATION >= $(last6month) and num(DATE_VALIDATION) <= $(maxDate),DATE_VALIDATION)

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Still doesn't work

ali_hijazi
Partner - Master II
Partner - Master II

make all your date fields numbers

num(dayStart(your_date_field))

use whatever you want then on the chart use the number tab to make the dates readable

I can walk on water when it freezes
Not applicable
Author

I think I found the problem. I don't know why but it comes from the max function

When I remove max in both variables it works!