# Calculate Sunday in given week.

Hi Experts

Need your assistance please.  I have a field "date" in a report that I then need to calculate the Sunday date of the week that the date falls.
The date field is actually formatted as a date (mm/dd/yyyy) if that is relevant.

Andy
###### Who is Participating?

Commented:
I assume it is on the one using the datefield.  Missed the closing }

mlmcc
0

Commented:
0

Author Commented:
Maybe I am missing something but your solution is giving me the "day name" for my date.  I don't need this but rather need the date of the last day of that week (Sunday).  The results should always be a Sunday.
0

Commented:
Try this formula based on currentdate

If you are using a database field then change CurrentDate to the field

mlmcc
0

Commented:
If DayOfWeek({@Today}) = 2 Then
Else If DayOfWeek({@Today}) = 3 Then
Else If DayOfWeek({@Today}) = 4 Then
Else If DayOfWeek({@Today}) = 5 Then
Else If DayOfWeek({@Today}) = 6 Then
Else If DayOfWeek({@Today}) = 7 Then
Else If DayOfWeek({@Today}) = 1 Then
0

Author Commented:
mlmcc---getting error message--"a number is required"

0

Author Commented:
BlueYonder

Your solution is giving me the Sunday before the date.  What I need is Sunday as the last day of the week.  If my date is 12/13/2013 which is a Friday I need 12/15/13 which would be the last day of the week (Sunday).
0

Author Commented:
Thanks so much for your elegant solution.  It still was using Sunday as the 1 day of the week so for example if I had a date of 12/13/13 (Friday) it was returning 12/8/13 (Sunday) where I wanted 12/15/13 (Sunday).  This would make Sunday the last day of the week.  I just added 7 to your formula and it gave me the proper date required.

Andy
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.