Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

displaying dates of current month on every Sunday

i want to create 4 or 5 variables carrying dates on every sunday of current month. please help me with the farmula to build one such variable.

thanks

saqib

replied

Here are some formulas you can use:

//@FirstSunday

minimum(MonthToDate) + (if dayofweek(minimum(MonthToDate)) = 1 then 0 else (7 - dayofweek(minimum(MonthToDate)) + 1))

//@SecondSunday

dateadd("ww",1,{@FirstSunday})

//@ThirdSunday

dateadd("ww",2,{@FirstSunday})

//@FourthSunday

dateadd("ww",3,{@FirstSunday})

//@FifthSunday

if dateadd("ww",4,{@FirstSunday}) >= dateadd("m",1,minimum(monthtodate))

then date(1900,1,1)

else dateadd("ww",4,{@FirstSunday})

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question