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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
snamhoang
New Member

Create Week column starting from Tuesday and ending next Tuesday

Hi guys, 
I am trying to create a week column (displaying week number) which starts from Tuesday and ends next Tuesday.
Any suggestion?
I used Weeknum 21 but it starts from Mon, not Tue.

 

Thanks a lot

1 ACCEPTED SOLUTION
Phil_Seamark
Employee
Employee

Hi @snamhoang

 

Please add this calculated column to your Calendar table

 

Week Starting Tuesday = 
var offset = switch(FORMAT('Dates'[Date],"DDD"),
    "Tue",0,
    "Wed",-1,
    "thu",-2,
    "Fri",-3,
    "Sat",-4,
    "Sun",-5,
    "Mon",-6
    ,0)
Return DATEADD('Dates'[Date],offset,DAY)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Employee
Employee

Hi @snamhoang

 

Please add this calculated column to your Calendar table

 

Week Starting Tuesday = 
var offset = switch(FORMAT('Dates'[Date],"DDD"),
    "Tue",0,
    "Wed",-1,
    "thu",-2,
    "Fri",-3,
    "Sat",-4,
    "Sun",-5,
    "Mon",-6
    ,0)
Return DATEADD('Dates'[Date],offset,DAY)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

GilbertQ
Super User
Super User

Hi @snamhoang,

 

What I would do is to suggest creating a new column in the Query Editor.

 

In doing that you can easily create it in your Date table, and from there you could then create your weeks also based off your Week Number column?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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