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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
eduardosilvin3
Advocate I
Advocate I

Week definition due to the end and start of the year

Hello All, I have this calc column, but the start dates are not correct, because when the year is starting, the Week Text must says:

 

-for dec-27 to dec-31:  "W #53 Dec-27 / Dec-31" 

-for jan1 and jan2: "W #1 Jan-01 / Jan-02" 

eduardosilvin3_0-1703668511049.jpeg

 

Same for next years... any ideas?

2 ACCEPTED SOLUTIONS
Fowmy
Super User
Super User

@eduardosilvin3 

Create a calculated column as follows:

Week Text = 
VAR __T = FILTER( 'Calendar' , Calendar[Week Year] = EARLIER( 'Calendar'[Week Year] ) )
VAR __MinDate = MINX(__T , Calendar[Date] )
VAR __MaxDate = MAXX(__T , Calendar[Date] )
RETURN
    "W #" & Calendar[Week Num] & " " & FORMAT( __MinDate , "Mmm-yy" ) & "/ " & FORMAT( __MaxDate , "Mmm-yy" )

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

try this @eduardosilvin3

Week Text =
VAR CurrentWeekYear = Calendar[Week Year]
VAR WeekStart = CALCULATE(MIN(Calendar[Date]), ALLEXCEPT(Calendar, Calendar[Week Year], Calendar[Week Num]))
VAR WeekEnd = CALCULATE(MAX(Calendar[Date]), ALLEXCEPT(Calendar, Calendar[Week Year], Calendar[Week Num]))
RETURN
"W #" & Calendar[Week Num] & " " & FORMAT(WeekStart, "MMM-yy") & " / " & FORMAT(WeekEnd, "MMM-yy")

 

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

Appreciate your Kudos!! 

LinkedIn | Twitter | Blog | YouTube 

View solution in original post

6 REPLIES 6
Fowmy
Super User
Super User

@eduardosilvin3 

Create a calculated column as follows:

Week Text = 
VAR __T = FILTER( 'Calendar' , Calendar[Week Year] = EARLIER( 'Calendar'[Week Year] ) )
VAR __MinDate = MINX(__T , Calendar[Date] )
VAR __MaxDate = MAXX(__T , Calendar[Date] )
RETURN
    "W #" & Calendar[Week Num] & " " & FORMAT( __MinDate , "Mmm-yy" ) & "/ " & FORMAT( __MaxDate , "Mmm-yy" )

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Working great, thanks!

VahidDM
Super User
Super User

Can you share the details of the week start date and end date please?

 

Appreciate your Kudos!! 

LinkedIn | Twitter | Blog | YouTube 

sure sorry:

 
Week Start Date = (SELECTEDVALUE('Calendar'[Date]) - WEEKDAY(SELECTEDVALUE('Calendar'[Date]),2) +1)
 
Week End Date = (SELECTEDVALUE('Calendar'[Date]) - WEEKDAY(SELECTEDVALUE('Calendar'[Date]),2) +7)

try this @eduardosilvin3

Week Text =
VAR CurrentWeekYear = Calendar[Week Year]
VAR WeekStart = CALCULATE(MIN(Calendar[Date]), ALLEXCEPT(Calendar, Calendar[Week Year], Calendar[Week Num]))
VAR WeekEnd = CALCULATE(MAX(Calendar[Date]), ALLEXCEPT(Calendar, Calendar[Week Year], Calendar[Week Num]))
RETURN
"W #" & Calendar[Week Num] & " " & FORMAT(WeekStart, "MMM-yy") & " / " & FORMAT(WeekEnd, "MMM-yy")

 

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

Appreciate your Kudos!! 

LinkedIn | Twitter | Blog | YouTube 

Working great, thanks!

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.