3 Replies Latest reply on Mar 30, 2018 6:49 AM by Michael Hesser

# Week Number for the current Month

Hi,

Can someone help me with a formula that gives the Week Number for the Month and not for the calendar.

For Ex: For  '30/3/2018' I need result as 'Week 5' and

6/4/2018 as 'Week 1'

• ###### 1. Re: Week Number for the current Month

Hi Garima,

You can achieve this by using below logic -

Regards,

Aman

1 of 1 people found this helpful

• ###### 3. Re: Week Number for the current Month

Hello Garima--

Note that some months may have six weeks in them, so you'll need to modify the nested IF statements above.

Alternative expressions:

If you are looking for the calendar week by month:

WeekOfMonth

DATEPART('week', [Order Date]) - DATEPART('week', DATETRUNC('month',[Order Date])) + 1

You'll want to convert this calc to a Dimension.

Using this, March 4, 2018 would be "2"

If you are looking to count each group of 7 days (like the IF statements above), you could try this quickie:

WeekOfMonth

INT((DAY([Order Date])-1)/7)+1

Using this, March 4, 2018 would be "1"

Good luck! --Michael