1 Reply Latest reply: Feb 28, 2018 4:14 AM by Marcus Sommer RSS

    Help with QlikSense Variables

    Colin Pelham

      Hello,

       

      I am building an app and have the following variable:

       

      MaxReviewDate: DATE(MAX({<Review_Metric={'Number_Of_Reviews'}, Review_Value = {">0.1"}>} Date_Value),'YYYY-MM-DD' )

       

      I am using it in this measure:

       

      AVG({$< Date_Value = {"$(=$(MaxReviewDate))"}, Review_Metric={'Number_Of_Reviews'}  >} Review_Value)


      When using this in a table i get the following output (please focus on the last two columns):


      QlikHelp.PNG


      The last column shows the variable varying by row, but the middle column is not showing some data points where there definitely should be. It seems the variable is only calculating to 2018-02-26 for all rows in the measure, however you can see it should be changing to 2018-02-19 for the blank rows.


      Is there anything I should be adding to the measure to make the variable calculate row by row?


      Thank you for you help,


      Colin







        • Re: Help with QlikSense Variables
          Marcus Sommer

          Creating anything with a $-sign expansion means to create an adhoc-variable which could have only one value at a time. This meant that the content of these variables is evaluated ones before the chart is calculated and applied to each row - in no way it could be used on row-level.

           

          This meant you need a different approach, maybe this one:

           

          if(Date_Value = $(MaxReviewDate),

               AVG({$< Review_Metric={'Number_Of_Reviews'} >} Review_Value))


          - Marcus