Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
cheid1977
Helper I
Helper I

How to show week number per month?

I need to show how much volume shipped the first, second, third, and fourth week of each month. How can you assign a number (1-4 or 5) to each week of the month?  Thanks.

1 ACCEPTED SOLUTION
v-micsh-msft
Microsoft Employee
Microsoft Employee

Hi cheid1977,

 

Please take a try with the formula below in a calculated column:

weekinmonth = 1 + WEEKNUM ( 'Calenda'[Date] )-WEEKNUM( STARTOFMONTH ('Calenda'[Date]))

This formula would work with the month level, which should be no calculated errors.

 

Please reply back if you need any further assistance on this topic.

Regards

 

View solution in original post

11 REPLIES 11
jkaluki254
New Member

Did you ever get a solution for this, currently facing the same challenge........:(

theov
Advocate II
Advocate II

You can use mix of STARTOFMONTH and WEEKNUM to do that.

Here is a good video explaining it:

https://www.youtube.com/watch?v=Oq5WOmo94_Q

ahmhekal
New Member

I used this formula :
 
Week = (DAY('Calendar'[Date])+2.5) /7
Anonymous
Not applicable

i need add to my date hierarchy the number of month. i dont want show the name month( jan, feb, etc) 
, i want show the number month (1,2,3). Can you help me ?



 

v-micsh-msft
Microsoft Employee
Microsoft Employee

Hi cheid1977,

 

Please take a try with the formula below in a calculated column:

weekinmonth = 1 + WEEKNUM ( 'Calenda'[Date] )-WEEKNUM( STARTOFMONTH ('Calenda'[Date]))

This formula would work with the month level, which should be no calculated errors.

 

Please reply back if you need any further assistance on this topic.

Regards

 

Si tu semana empieza en LUNES, la fórmula quedaría así:

 

=1 + WEEKNUM(Calendario[Date];2)-WEEKNUM(STARTOFMONTH(Calendario[Date]);2)

This is a good solution, but it only works if all the dates are unique.

In some cases, you would use a date column like invoiced date, start date, etc

 I hope this code would help:

Week Num =
 WEEKNUM ( 'Your table'[Your Date column] )-('Your table'[Your Date column].[MonthNo]-1)*4
Anonymous
Not applicable

Thanks for the response but I have a problem I get Weekmonth in some cases from 1 to 6 . I was Expecting 1to 5 but i get even more possible values. Any idea?

This answer was very usefull to me! Thanks v-micsh-msft!

Greg_Deckler
Super User
Super User

OK, I didn't fully test this, but the general concept should work, you may have to tweak.

 

These are all columns:

 

WeekN = WEEKNUM([Date])

MonthN = MONTH([Date]) 

Column 9 = IF([MonthN] = 1,1,([MonthN]-1)*4)

Column 5 = IF([Column 9]=1,1,[WeekN] - [Column 9] - 1)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

Hard to say without your data or some sample data. I think the right way would be to add a custom column to your Date table.

 

 

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.