3 Replies Latest reply: Mar 6, 2018 3:53 AM by Pablo Labbe RSS

    Expression inside Set Analysis

    Mark Ritter

      I want to do a calculation (AVG) based on a date falling in a certain date range.

       

      I tried something like this and this works. Attempted to calculate the metric for records that fall in the past 90 days.

       

      =avg( {<CalendarDate={">=12/03/2017"}>} ($(vCheckinTime))*1440)

       

      But I have to hard code the date that is 90 days ago. 

       

      I tried to replace the hard coded date with today()-90 but I get no results.

       

      Is this even possible in Set Analysis?  If it is what should the syntax be?

        • Re: Expression inside Set Analysis
          omar bensalem

          Let's assume that ur calendar date is recognized by qlik as a date and has a format as follow : DD/MM/YYYY

          do sthing as follow:

           

          avg({<CalendarDate={">=$(=date(today(1)-90,'DD/MM/YYYY'))"}>}urMeasure)

           

          or (depends on what type of analysis u want, it maybe be:

           

          avg({<CalendarDate={">=$(=date(max(CalendarDate)-90,'DD/MM/YYYY'))"}>}urMeasure)

          • Re: Expression inside Set Analysis
            THIAGO TEIXEIRA

            What about this:

             

            avg( {<CalendarDate={">=$(=AddMonths(Date (Today ()),-3))"}>} ($(vCheckinTime))*1440)

            • Re: Expression inside Set Analysis
              Pablo Labbe

              When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others