Jump to content

This topic is 4625 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

There's a calculation function for WeekOfYear, but not WeekOfMonth. I was trying to find a forum topic on it last week and didn't see one, then I came up with a solution that seems to work well.

First, create a field that calculates the first of the month for the given date in your original date field. So if the original date filed is called 'Date' and the new field is called 'FirstOfMonth':

FirstOfMonth = GetAsDate ( ( Month ( Date ) & "/" & "1/" & Year ( Date ) ) )

Then subtract the WeekOfYear for the FirstOfMonth field from the WeekOfYear for the Date field:

WeekOfYear ( Date ) - WeekOfYear ( FirstOfMonth ) + 1

The plus one is because a date in the first week of the month would be 1 - 1 so it cancels out. I hope someone else can find this useful. This forum has been very helpful to me so when I came up with a solution I couldn't find on here I wanted to share it and give something back. I know it's pretty basic but it's still useful.

This topic is 4625 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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