Previous YTQ, QTD, MTD and WTD

    In reference to YTQ, QTD, MTD and WTD

     

    This is to a analysis of Sales up to the Selected day in Previous year.

    YTD - Year To Date

    A date should be selected and it will look for the Starting date of the Previous year to the selected day of previous year.

    Ex: date selected is 21-03-2014 then Previous YTD is 01-01-2013 to 21-03-2013

    Expression would be

    Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=$(=Num(YearStart(Max(DateNum), -1)))<=$(=AddYears(Max(DateNum), -1))"}>} Sales)

     

    Previous QTD- Quarter to Date

    In the place of year use Quarter

    Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=$(=Num(QuarterStart(Max(DateNum), -4)))<=$(=AddYears(Max(DateNum), -1))"}>} Sales)

     

    Previous MTD- Month to Date

    Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=$(=Num(MonthStart(Max(DateNum), -12)))<=$(=AddYears(Max(DateNum), -1))"}>} Sales)

     

    Previous WTD- Month to Date

    Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=$(=Num(WeekStart(Max(DateNum), -52)))<=$(=AddYears(Max(DateNum), -1))"}>} Sales)


    Let me know if there is any concerns.