1 Reply Latest reply on Apr 12, 2018 3:59 PM by Cathy Bridges

    Make a range dynamic date filter

    hulk cogan

      Dear all,

       

      Just curious how to make a range dynamic date filter.

      For example,

      this year  the date filter will filter all the sales on the period in June 2016 - July 2017.

      next year the date filter will filter all the sales on the period in June 2017 - July 2018.

       

      Any help will be very appreciated, thanks!

        • 1. Re: Make a range dynamic date filter
          Cathy Bridges

          I usually do something like this:

          IF DATEDIFF('month',[Date],[MaxDate])<=11

          then

          'CY'

          elseIF DATEDIFF('month',[Date],[MaxDate])>11

          and DATEDIFF('month',[Date],[MaxDate])<=23

          THEN 'PY'

          ELSE NULL END

           

          MaxDate is an LOD {MAX([Date])} but you could also make it a parameter, so in your case you might select July 2018 in your parameter list.

           

          Let me know if you need an example - I can whip one up for you.