3 Replies Latest reply: Aug 8, 2017 6:11 AM by Sasidhar Parupudi RSS

    Variable on a Variable on Load Data

    Dale Pinn

      I have used the variable interface on the front end of Qlik Sense and it is difficult to see what is happening. I then moved the variables to load when the data loads, except that when I load a variable on a variable it does not work.

       

      // Monthly Variables For Sales

      set v_Week_STTT_Current_Year = '=max({<TransactionType={"STTT_WEEK_SALES_RANDS"}>}_KeyActualYearID)';

      WORKS; Answer is 2018

      set v_Week_STTT_Previous_Year = '=$(v_Week_STTT_Current_Year) - 1';

      WORKS; Answer is 2017

      Set v_Week_STTT_Current_Month = '=max({<TransactionType={"STTT_WEEK_SALES_RANDS"},FinancialYear={"=(v_Week_STTT_Current_Year)"}>}_KeyActualMonthID)';

      DOES NOT WORK: Answer given is 12 where data is only loaded up to 6

      Set v_Week_STTT_Current_Week = '=max({<TransactionType={"STTT_WEEK_SALES_RANDS"},FinancialYear={"=(v_Week_STTT_Current_Year)"}>}ActualWeekLink)';

      DOES NOT WORK: Answer given is 52 where data is only loaded up to 32


      How do I refer to a variable within a variable on load script?

        • Re: Variable on a Variable on Load Data
          Sasidhar Parupudi

          May be try like following

           

          LET v_Week_STTT_Current_Year = 'max({<TransactionType={"STTT_WEEK_SALES_RANDS"}>}_KeyActualYearID)';

          LET v_Week_STTT_Previous_Year = '$'&'(v_Week_STTT_Current_Year) - 1';

          LET v_Week_STTT_Current_Month = 'max({<TransactionType={''STTT_WEEK_SALES_RANDS''},FinancialYear={'&chr(39)&'$'&'(=v_Week_STTT_Current_Year)''}>}_KeyActualMonthID)';

          LET v_Week_STTT_Current_Week = 'max({<TransactionType={''STTT_WEEK_SALES_RANDS''},FinancialYear={'&chr(39)&'$'&'(=v_Week_STTT_Current_Year)''}>}ActualWeekLink)';