0 Replies Latest reply: Jul 16, 2010 6:43 AM by Julien Bruchon RSS

    Dynamic Week calculation - YTD

      Hi,

      I try to reaise a dynamic investments dashboard on a weekly basis.

      I picked up the formulas from Jason's "YTD calculations using set analysis" and it works well for the current week calculation as I replaced Month by Week.

      sum({$<Year = {$(=max(Year))}, Week = {"<=$(=max({<Year={$(=max(Year))}>} Week))>$(=max({<Year={$(=max(Year))}>} Week)-1)"}>} Field)

       

      But for "Previous Week" calculation, a function "addmonths" is used and apparently there is not the same for Week purpose.

      sum({$<Year = {$(=max(Year) - $(=if(max(Month) = 1, 1, 0)))}, Month = {$(=month(addmonths(max(MonthYear), -1)))}>} Field)

       

      Does anyone have a trick to get through ?

      Regards,

       

      Julien