7 Replies Latest reply: Jul 18, 2016 11:46 AM by Vladimir Komarov RSS

    Chart is not updated automatically if variable is used as Expression (requires refresh)

    Vladimir Komarov

      Hi all,

       

      I've noticed a strange issue:


      I do have a chart that uses variables in Set Analysis.

      Example:

      //Variables defined in the script:

      let vDR1Start = Num(MakeDate(2016,6,20));

      let vDR1End = Num(MakeDate(2016,6,27));

      let vDR2Start = Num(MakeDate(2016,5,20));

      let vDR2End = Num(MakeDate(2016,5,28));


      These variables are defining the range of dates the chart is displaying the numbers for (Start/End of Periods 1 and 2)

       

      The Set Analysis looks like:

      sum({<Date = {"=(Date<='$(vDR1End)' and Date>='$(vDR1Start)')"}>} Sales)

       

      The chart is working properly and is updated as soon as variables are updated in the app.

       

      I was hoping to create a single variable to use in all related charts in the application.

      This new variable in the script looks like:

       

      set vSumPeriod1 = sum({<Date = {"=(Date<=vDR1End and Date>=vDR1Start)"}>} Sales);

       

      But if this vSumPeriod1 variable is used in chart's measure, the chart is not updated automatically as soon as variable is changed!

      It requires a "refresh" - for example if ANY field is selected and cleared - the chart is immediately updated.

       

      I am attaching the demo application to this post so the issue will be more visible.

      The chart on the right is using "normal" Set Analysis, the one on the left uses variables.


      To change variables, I am using an extension from the Branch (Qlik Branch)(also attached).

      You can enter Dates as Numeric or Date formats, it does not matter.

       

      I am really puzzled with this issue. Not sure if it's a bug in QS or I need to update my Expression's variable differently to handle this case.

       

      Will appreciate an advice.

       

      Regards,

      Vladimir