Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
maryna_hubska
Contributor II
Contributor II

Date variable not showing correct value

HelloI I need to filter different tables by date. I wanth to do this using start and date variables.

I have some problems with this, because I cann't count date difference or even look at year number

 

maryna_hubska_0-1677758307303.png

 

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Date() is a Formatting Function

Date#() is an Interpretation Function

 

Check the DateFormat variable set in the "Data Load Editor"

All field recognized as date fields will have the below format as defined in variable DateFormat 

vinieme12_0-1677822911494.png

 

Change Variable Definition to below

start_date

= Date(Today()-20)    // with the leading equal sign

end_date

= Date(Today())  // with the leading equal sign

date_diff

=year($(end_date))

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

4 Replies
Gabbar
Specialist
Specialist

You are using Date and Date# functions in wrong way, 
Date# is used to define format in which your date is present in Source ,
Date is used to define format you want it as output.

try using 
start_date as  date(today()-20)
end_date  as date(today())
date_diff as year($(=end_date)) or year(Today()) as your end_date is same as today()

maryna_hubska
Contributor II
Contributor II
Author

Unfortunately, this doesn't work

maryna_hubska_0-1677791801417.png

 

Gabbar
Specialist
Specialist

Dont know why is this happening
Meanwhile try these in yours:

Gabbar_0-1677819292235.png


If i get to know why that is happening, will get back to you in this same thread.

 



vinieme12
Champion III
Champion III

Date() is a Formatting Function

Date#() is an Interpretation Function

 

Check the DateFormat variable set in the "Data Load Editor"

All field recognized as date fields will have the below format as defined in variable DateFormat 

vinieme12_0-1677822911494.png

 

Change Variable Definition to below

start_date

= Date(Today()-20)    // with the leading equal sign

end_date

= Date(Today())  // with the leading equal sign

date_diff

=year($(end_date))

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.