1 Reply Latest reply on May 17, 2017 1:41 PM by Patrick A Van Der Hyde

    understanding syntax

    Alex Martino

      This is supposed to show current date, pmtd, and pymtd. Can someone please explain the syntax? First satisfied date is equivalent to date.

       

      DATETRUNC('month', [First Satisfied Date]) <= DATETRUNC('month', [MaxDate]) //Optional. Ex WB contains Dates passed Today

      AND

      (

          //Current Month and Previous Month

          DATETRUNC('month', [First Satisfied Date]) >= DATEADD('month', -1, DATETRUNC('month', [MaxDate])) //Current Month and Previous Month

          OR

          //Current Month in Previous Year

          DATETRUNC('month', [First Satisfied Date]) = DATEADD('year', -1, DATETRUNC('month', [MaxDate]))

      )

       

       

      AND

       

       

      (

          [MaxDate] =  DATEADD('day', -1, DATEADD('month', 1, DATETRUNC('month',[MaxDate]))) //Last day of Month

          OR

          DAY([First Satisfied Date]) <= DAY([MaxDate]) //IF TODAY is not the last day of the month, return MTD

      )