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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
logan_logan
Helper I
Helper I

Merge date with week number

Hi,

I am trying to convert date into week suchway: Week number (fisrt day of that week - last day of that week)

Example:     "Week-21 (20 May -26 May)"

. I was able to extract week number "Week-21" but then adding the date of that week with Week number is unable to do. The week starts from Monday-Sunday.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @logan_logan ,

I create a table as you mentioned.

vyilongmsft_0-1716524948966.png

Then I create a calculated column and here is the DAX code.

Week Description =
VAR WeekNumber =
    "Week-" & WEEKNUM ( [Date], 2 )
VAR WeekStart =
    [Date] - WEEKDAY ( [Date], 2 ) + 1
VAR WeekEnd = WeekStart + 6
RETURN
    WeekNumber & " ("
        & FORMAT ( WeekStart, "dd MMM" ) & " - "
        & FORMAT ( WeekEnd, "dd MMM" ) & ")"

Finally you will get what you want.

vyilongmsft_1-1716525082121.png

 

 

 

Best Regards

Yilong Zhou

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

3 REPLIES 3
Anonymous
Not applicable

Hi @logan_logan ,

I create a table as you mentioned.

vyilongmsft_0-1716524948966.png

Then I create a calculated column and here is the DAX code.

Week Description =
VAR WeekNumber =
    "Week-" & WEEKNUM ( [Date], 2 )
VAR WeekStart =
    [Date] - WEEKDAY ( [Date], 2 ) + 1
VAR WeekEnd = WeekStart + 6
RETURN
    WeekNumber & " ("
        & FORMAT ( WeekStart, "dd MMM" ) & " - "
        & FORMAT ( WeekEnd, "dd MMM" ) & ")"

Finally you will get what you want.

vyilongmsft_1-1716525082121.png

 

 

 

Best Regards

Yilong Zhou

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

AnalyticPulse
Super User
Super User

Hello @logan_logan 
please try below dax :
Week Range =
VAR StartOfWeek = STARTOFWEEK('YourDateColumn', 2) 
VAR EndOfWeek = StartOfWeek + 6
RETURN
"Week-" & FORMAT(StartOfWeek, "ww") & " (" & FORMAT(StartOfWeek, "dd MMM") & " - " & FORMAT(EndOfWeek, "dd MMM") & ")"

 

Learn Power BI free:

https://analyticpulse.blogspot.com

Learn Power BI free

Powerbi Visualisation

 

AnalyticPulse_0-1715829624787.png

 

can you please recheck this part?

VAR StartOfWeek = STARTOFWEEK('YourDateColumn', 2) 

there is no such function like STARTOFWEEK

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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