2 Replies Latest reply: Mar 26, 2018 1:34 PM by Anitha Lux RSS

    Calendar Object

    Anitha Lux

      I have a calendar table created in my edit script that generates dates from today() to 3 years prior.

      LET vToday =Today()

      LET Start = num(makedate(Year(addyears(today(),-3)),1,1)); 

      LET End = vToday;

      LET NumOfDays = End - Start + 1;



      $(Start) + Rowno() -1 as DateID

      AUTOGENERATE $(NumOfDays);


      I need to change the calendar to show only dates between auditdb.LastmodifiedDate and prior 3 years.


      changing vToday variable to auditdb.LastmodifiedDate is throwing an error.

      LET vToday =num(makedate(Year(AuditDB.LastProcessedDate),Month(AuditDB.LastProcessedDate),Day(AuditDB.LastProcessedDate)));

      What could be wrong? The AuditDB.LastProcessedDate is in the datamodel.

        • Re: Calendar Object
          Gysbert Wassenaar

          The AuditDB.LastProcessedDate is in the datamodel.

          But in which tables? And in which row? How should Qlik Sense know which table it should look in and which record it should get the value from? The same field can exist in many tables and a field in one table can have many values.


          That's why you have to be explicit and use the peek function to get the value you want from the table:


          LET vMyDate = peek('[AuditDB.LastProcessedDate]', 83949, 'MyAuditTable');


          Replace MyAudit table with the name of the table from which the field value should be retrieved and replace 83949 with the row number in that table that contains the value. When using peek 0 means the first row and -1 means the last row.

          • Re: Calendar Object
            Anitha Lux

            Thank you .. This helped me with the solution.