4 Replies Latest reply: Dec 7, 2012 8:31 AM by Jeroen Jordaan RSS

    Create Indicator for 4, 8, and 13 weeks ago in Calendar

    Jeroen Jordaan

      Hello QlikViewers,

       

      I have a question that I just not can find a good solution for.
      I have build a MasterCalendar from a specific Excel file from our Customer (The customer has created his own financial calendar in Excel).

       

      I want to create an indicator in the calendar for al the weeks that are this week, 4, 8 and 13 for weeks ago but also the weeks This week, 4, 8 and 13 weeks ago last year.

       

      I want to create an indicator for easy use in set analysis so I can compare week.

       

      Thanks for all the help.

        • Re: Create Indicator for 4, 8, and 13 weeks ago in Calendar
          Vlad Gutkovsky

          Jeroen,

           

          See the function inweek() which allows you to check whether the first parameter date lies within the week that the second parameter date belongs to. This function returns true (-1) if it is the case. So for example:

           

          -1 * rangemin(inweek(MyDateField,today()),inweek(MyDateField,addyears(today(),-1))) as InCurrentWeek

           

          This will return true if the date is in the current week or in the same week last year. It should be pretty easy for you to extrapolate this to do the 4, 8 , 13 week logic. Final note: since it's a fiscal calendar, you may need to use the 3rd parameter of the function to shift things around. See the Help file for more details.

           

          Regards,

          Vlad