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

can any one explain this ?

                       YeartoDate(TempDate)*-1 as CurYTDFlag, 

  •                YeartoDate(TempDate,-1)*-1 as LastYTDFlag, 
  •                inyear(TempDate, Monthstart($(varMaxDate)),-1) as RC12, 

                        Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,

how it works      pls?

2 Replies
alexandros17
Partner - Champion III
Partner - Champion III

     YeartoDate(TempDate)*-1 as CurYTDFlag,

yeartodate return true if date fall in the year of the date so if it is true (that is -1) multiply by -1 and have 1, if it is false (that is 0) you have 0

  •                YeartoDate(TempDate,-1)*-1 as LastYTDFlag,

The same as previous but for previous year

  •                inyear(TempDate, Monthstart($(varMaxDate)),-1) as RC12,

returns true if date falls inside the year computed from Monthstart($(varMaxDate)),-1) that is the starting date of the month before the one indicated by the variable

                        Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,

this returns a string with the week of the date of weekstart and its year

its_anandrjs
Champion III
Champion III

Hi,

YeartoDate(TempDate)*-1 as CurYTDFlag,

This is calculates the values as true and false depends on the result YeartoDate returns the true and false according to the result it gives output as 1 and 0

YeartoDate(TempDate,-1)*-1 as LastYTDFlag,

This calculates the previous year values as 1 and 0

inyear(TempDate, Monthstart($(varMaxDate)),-1) as RC12,

Returns true if date lies inside the year containing Monthstart($(varMaxDate)) and according to that multiples.

Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,

And this returns the Week of the weekstart(TempDate)

Regards

Anand