Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Can any one explain me how this is working i mean the workflow of this statement.
"If(Year2Date(Date, 0, 1, Today()), 1, 0) As YTDFlag,"
I am new to qlikview
Looking at QlikView help, I didn't find Year2Date(), but YearToDate() function. But the funny thing is that although the syntax editor doesn't understand Year2Date, it still resolves to the same result as YearToDate().
Anyways, coming back to the expression (yeartodate ‒ QlikView), helps show this
So, this in your script will work like this
If(Year2Date(Date, 0, 1, Today()), 1, 0) As YTDFlag
1) Date -> This is the Date field you are trying to figure out if it is in the YTD or not
2) 0 -> Year Offset... is this for the current year (0) or last year (-1). Right now you have it from the current year's YTD
3) 1 -> First month of the year. Do you have January as your 1st month (1) or April as the first month (4)
4) Today() -> What is the upper limit of the YTD. In your case you are trying to figure out YTD till today(). So in case you have data points for August 2017, they would not be part of your YTDFlag
Does this make sense? The link I have shared have few example, do take some time to check them out.
Best,
Sunny