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: 
Anonymous
Not applicable

INYEARTODATE?

Can any one gie the easy example for    inyeartodate

what is 0 or -1 year how it works

I checked help files its bit confusing for me ?

Thanks in advance

1 Solution

Accepted Solutions
Gysbert_Wassenaar

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

The base date is 2006-02-01. So the year-to-date period is 2006-01-01 to 2006-02-01. The date 2006-01-25 lies within that period so the inyeartodate function returns true

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

The base date is 2006-01-01. So the year-to-date period is 2006-01-01 to 2006-01-01. The date 2006-01-25 lies outside that period so the inyeartodate function returns false.


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

0 and -1 are the numeric values of the boolean false and true values.

From the help file:


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, 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

Can you tell us which of the examples from the help you don't understand?


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

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

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

can u give explination on this

Gysbert_Wassenaar

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

The base date is 2006-02-01. So the year-to-date period is 2006-01-01 to 2006-02-01. The date 2006-01-25 lies within that period so the inyeartodate function returns true

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

The base date is 2006-01-01. So the year-to-date period is 2006-01-01 to 2006-01-01. The date 2006-01-25 lies outside that period so the inyeartodate function returns false.


talk is cheap, supply exceeds demand