Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hey kids.

I need a calculation that will look at a date and return the Monday of that week. e.g. If date = 8/18/2001, WeekOf_c = 8/15/2001

I know that I can do this with a long Case statement, testing for which day of the week it is, then subtracting the appropriate number:

Case(DayName(date) = Tuesday, date - 1,

DayName(date) = Wednesday, date - 2,

... and so on

but is there any other way. I like to keep my calculations as short as possible.

Thanks, eh.

Paul

Case(DayofWeek(Date) = 1, Date + 1, Date - (DayofWeek(Date) - 2))

My second post, and I got a smiley face already. Thanks!

  • Author

Oh my God, rd. I bow in the presence of your genius.

I tried it out, and it works, of course, but for the life of me, I can't figure out why it works.

Please enlighten a simple creature.

... and thanks.

Paul

Case(DayName(date) = Tuesday, date - 1,

DayName(date) = Wednesday, date - 2,

... and so on

The answer why is in your "and so on" which indicates you recognize there is a pattern (i.e., date -1, date-2, date-3, etc.) The number you subtract from date can be simplified to DayofWeek - 2, since Monday is the second day of the week (If Monday(2), subtract 2-2, or none. If Tuesday(3) subtract 3-2, or one). Then you just need a special case for Sunday. If the week began with Monday (i.e., DayofWeek(Monday)=1 instead of 2), you could do it without the Case.

  • Author

Got it. Pretty smart, rd.

Thanks.

Paul

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.