1 Reply Latest reply: Jul 23, 2015 12:15 PM by Vitaly Avvakumov RSS

    Period of activity

    Vitaly Avvakumov

      Hi

       

      I have some difficultes with data Load/Analyse when we have daily date and data wich valid for different periods.


      for example:

      I have two tables

      1. daily actual data : date, actual value

      2. normatives data :  starting date, normative value

      I need to compare daily values with normatives wich was valid in chosen dates/periods

       

      Which way is correct: load a sertain table

      or

      write an expression in QlikSense report?

       

      How do you think?

        • Re: Period of activity
          Vitaly Avvakumov

          I solved this issue by writing the following script:

           

          SafetyStock_Norm:

          LOAD * INLINE

          [      DateSS,       SafetyStock

               01.01.15,      645

               10.01.15,      245

               12.02.15,      347

               01.03.15,      127

               01.07.15,      221 ];

           

          TempSafetyStock:

          LOAD

               *,

               rowno() as RowCounter,

               -Num(Date# (FieldValue('DateSS',recno())))+Num(Date#(FieldValue('DateSS',recno()+1))) as Duration

          Resident SafetyStock_Norm;

           

          For each a in FieldValueList('RowCounter')

               NEWTABLE:

               Load

                    Date(FieldValue('DateSS', $(a))+iterno()-1) as NewDate,

                    FieldValue('SafetyStock',$(a)) as SS

               Autogenerate 1 While iterno()<=FieldValue('Duration',$(a));

          next a;

           

          Drop Table TempSafetyStock;

          NEWTABLE is a table for concatinating and analysing it with any table of actual daily data,

          But I think there is a better solution.