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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

How to add the start of month on my weekly date column

 

Hi

Am trying to create a column in which is gives me the week no. of each month ( Every 7 days = 1 Week).

I successfuly created it, but am now facing an issue which the next month it continues counting and does not start again from week 1 as a new month.

I tried to use the "startofmonth" but couldn't make work.

 

Here's my code:

Column = " Week " & 1 + INT((INT('Calendar'[Date] - DATE(YEAR('Calendar'[Date]),1,1)))/7) & " - " & FORMAT('Calendar'[Date], "MMM")
 
And here's a screenshot of the column:

 

Screenshot (29).png

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous,

According to your description, here's my solution.

Column =
" Week "
    & 1
        + INT (
            (
                INT (
                    'Calendar'[Date]
                        - DATE ( YEAR ( 'Calendar'[Date] ), MONTH ( 'Calendar'[Date] ), 1 )
                )
            ) / 7
        ) & " - "
    & FORMAT ( 'Calendar'[Date], "MMM" )

Get the expected result.

vkalyjmsft_0-1645694489606.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

Column =
var weekNum = QUOTIENT( 'Calendar'[Day of month], 7 ) + 1
return "Week " & weekNum
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous,

According to your description, here's my solution.

Column =
" Week "
    & 1
        + INT (
            (
                INT (
                    'Calendar'[Date]
                        - DATE ( YEAR ( 'Calendar'[Date] ), MONTH ( 'Calendar'[Date] ), 1 )
                )
            ) / 7
        ) & " - "
    & FORMAT ( 'Calendar'[Date], "MMM" )

Get the expected result.

vkalyjmsft_0-1645694489606.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Not very clear

Usually, Start of month is

 

start of month  = eomonth([Date],-1)+1

 

Also check

 

Start of Week = [Date] -[WeekDay]+1 //monday
Month Week = QUOTIENT(DATEDIFF(Minx(FILTER('Date',[Start Month]=EARLIER([Start Month])),'Date'[Start of Week]),[Date],DAY),7)+1

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Am not looking for the start of month itself, just in how to put it in my code:

Column = " Week " & 1 + INT((INT('Calendar'[Date] - DATE(YEAR('Calendar'[Date]),1,1)))/7) & " - " & FORMAT('Calendar'[Date]"MMM")

 

My code now shows the week no. like this:

January 1-7 = Week 1

January 8-14 = Week 2

January 15-21 = week 3

etc

but when it comes to Feb for example it conitnues like:

Feb 1-7 = Week 6

Feb 8-14 = Week 7

etc

 

I want it to be like this

Jan 21-28 = Week 4

Jan 29-31 = Week 5

 

then restart

Feb 1-7 = Week 1

Feb 8-14 = Week 2

etc

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors