
1. Re: Calculate the amount of weeks in a month
Ken Flerlage Jun 27, 2018 12:44 PM (in response to MarcAntoine Provost)What exactly are you basing this on? March has 31 days and April has 30 days, so where do 4 weeks and 5 weeks come from? Is this something related to a fiscal calendar?

2. Re: Calculate the amount of weeks in a month
MarcAntoine Provost Jun 27, 2018 12:50 PM (in response to Ken Flerlage)Hi Ken,
Those were random numbers of week chosen by myself just to illustrate what I would like.

3. Re: Calculate the amount of weeks in a month
Ken Flerlage Jun 27, 2018 1:09 PM (in response to MarcAntoine Provost)But what are you trying to calculate exactly? Every month has at least 4 weeks, but less than 5 weeks. How do you want to determine the number of weeks in a month?

4. Re: Calculate the amount of weeks in a month
Abhinav Garg Jun 27, 2018 1:14 PM (in response to MarcAntoine Provost)Hi Marc,
I tried doing this, couldn't get through it all but here is what I did. Maybe someone can finish it.
I made a calculated filed.
Drag it to Text in Mark card and Quick table calculation: Difference
Then edit the table calculation to restrict it to monthly level.
Now this removes the first month for each year because there is no previous value for tableau to subtract from. If in your case it's January then I won't worry about it since January always have 4 weeks. If not, then it will need some work my friend.
Happy Vizing!
PS Result:

5. Re: Calculate the amount of weeks in a month
Anisha Jhamb Jun 27, 2018 1:54 PM (in response to MarcAntoine Provost)2 of 3 people found this helpfulHi,
I think you could use the following approach:
I created a calculation as :{FIXED year([Order Date]), month([Order Date]):COUNTD(DATEPART('week',[Order Date]))}
It counts the distinct number of weeks in a given month in a year.
Below is the screenshot:

6. Re: Calculate the amount of weeks in a month
Ken Flerlage Jun 27, 2018 2:05 PM (in response to Ken Flerlage)After seeing some of the other responses, I think I understand now. I'd suggest the following:
 Create a calculated field that gets the first date of the month.
 Create another calculated field that gets the first date of the next month.
 Create calculated fields that get the week number from each of the above dates.
 Do the math to calculate the weeks.
See the attached workbook.

Number of Weeks.twbx 34.8 KB

7. Re: Calculate the amount of weeks in a month
MarcAntoine Provost Jun 27, 2018 2:10 PM (in response to MarcAntoine Provost)Thank you everyone for your answers, it's very kind of you.
It really helped me resolve my problem.
Have a great day !

8. Re: Calculate the amount of weeks in a month
Deepak Rai Jun 27, 2018 2:14 PM (in response to Anisha Jhamb)Good Work Anisha!!!

9. Re: Calculate the amount of weeks in a month
Anisha Jhamb Jun 27, 2018 2:17 PM (in response to Deepak Rai)Thank you Deepak Rai

10. Re: Calculate the amount of weeks in a month
mark parker Mar 13, 2019 10:05 AM (in response to Anisha Jhamb)Based on what I am seeing, your calc is greater than 52 weeks in one year....meaning, its not accurate.