7 Replies Latest reply: Jul 10, 2018 8:15 AM by Sunny Talwar RSS

    Last 3 days and Month to date

    mazda miata

      Hi All,

       

      I have the following expressions:

       

      Current Month to date

      = sum({$<Month={"$(=Date(Max(Month),'MMM-YY'))"}>}[Sales])

       

      Previous Month to date

      = sum({$<Month={"$(=Date(addmonths(Max(Month),-1),'MMM-YY'))"}>}([Sales])

       

      these 2 works fine but i want to add another field that could see less 3 days Current Month to date and less 3 days Previous Month to date. e.g. i select July 1 to 5 but it would only select July 3 to 5 only on the next two expressions.

       

      My Script below:

       

      LOAD

      Day (Date) as DayDate,

      Month( Date) as MonthDate,

      Year (Date) as YearDate,

      Date(Date,'MM-DD-YYYY') as Date,

      Date(Date,'MMM-YY') as Month,

      Sales,

      Customers

      ;

      SQL SELECT * FROM dbo.customers;

       

      Thanks