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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

inYearToDate documentation

Hi,

I found this in the documentation :

InYearToDate ( date, basedate , shift [, first_month_of_year = 1] )

returns true if date lies inside the part of year containing basedate up until and including the last millisecond of basedate. The year can be offset by shift. Shift is an integer, where the value 0 indicates the year which contains basedate. Negative values in shift indicate preceding years and positive values indicate succeeding years. If you want to work with (fiscal) years not starting in January, you may indicate a value between 2 and 12 in first_month_of_year.

Examples:

inyeartodate ( '2006-01-25', '2006-02-01', 0 ) returns true

inyeartodate ( '2006-01-25', '2006-01-01', 0 ) returns false

inyeartodate ( '2005-01-25', '2006-02-01', -1 ) returns true

I don't understand why the second example (bolded) returns false. Does someone understand why ? It looks like an error to me.

4 Replies
SunilChauhan
Champion II
Champion II

i believe that bold thing has no meaning .if u see the same function qlikview help u will find same thing which is not in bold.

sunil

Sunil Chauhan
Not applicable
Author

So you agree it should return true (or... that means 1st january 2006 is not in 2006.)

Anonymous
Not applicable
Author

I know it's one year late...

This is correct.  The bold line returns false because '2006-01-25' is not in the range between the start of the year of the base date ('2006-01-01') and the base date itself.

Regards,

Michael

Not applicable
Author

Hi ,

Qlikview is corrct............

The logic is '2006-01-25' lies in 2006 year but it is bigger than '2006-01-01' that is the reason it is showing false.