data_analyst
data_analyst

Reputation: 27

Week Number restarting at 1 every month as per ISO format in Tableau

I am trying to get week numbers ( resetting at 1 for each month) as per ISO format for each month in 2019.For example I am interested in getting

All dates in July 2019: week 1 to 4,

All dates in Aug 2019 : week 1 to 4 and so on.

I first created the calculated field (Week_Number_ISO) to get the overall week number in year 2019.I used the following formula;

DATEPART('iso-week',[ Date]) which works as intended.

To get the monthly week number I used the following formula

INT((DATEPART('day',[Created Date])-DATEPART('iso-weekday',[Created Date])+7)/7)+1.

(Idea was to calculate the date of the first day of each week & then divide by 7 and take the integer part)

As per the ISO format, shouldn't July 29 to 31st be a part of week 4 for July?But the formula is showing it as week 5 for July 2019.I feel I am missing something in the formula or am missing something about ISO week number resetting at 1 for each month.

Can someone help me?

Here is an example of the dates in July 2019 and the associated week numbers.

enter image description here

Upvotes: 0

Views: 1927

Answers (1)

Caleb
Caleb

Reputation: 359

Why would July 28th-July 31st 2019 be considered week 4?

Weeks of July 2019

Upvotes: 0

Related Questions