cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

Converting Week and Year for Week 53 to Show Week 01 for Next Year

Hi,

 

I'm having difficulties in converting week and year for week  53 (Dec 30 and 31, 2018) to be week 01 for 2019. Please note I am using storage mode as DirectQuery.

 

Currently what I have is Plan Date which contains the dates only.

 

I used this DAX formula to derive the week number: Week = CONCATENATE("",Right(CONCATENATE("0",WEEKNUM([Plan Date])),2))

 

I used this DAX formula to derive the year number: Year = CONCATENATE("",Right(CONCATENATE("0",YEAR([Plan Date])),4))

 

After getting week and year number, I then combine them using DAX formula:

Year/Week = CONCATENATE([Year],CONCATENATE("/",[Week]))

 

I don't want to use an IF statement wherein "2018/53" will be "2019/01" since I need to manually change it every year. Is there any convenient way to convert year x/week 53?

 

Appreciate any help you can provide me. 

 

Thanks and best regards,

Mark

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Solution Sage
Solution Sage

Re: Converting Week and Year for Week 53 to Show Week 01 for Next Year

You can change your calculated columns for week and year slightly, and get the desired results without having to change it every year.

 

Weeknum = CONCATENATE("",Right(CONCATENATE("0",IF(WEEKNUM(Sheet1[SampleDate]) > 52, 1, WEEKNUM(Sheet1[SampleDate]))),2))

 

Year = CONCATENATE("",Right(CONCATENATE("0", IF(WEEKNUM(Sheet1[SampleDate]) > 52, YEAR([SampleDate]) +1, YEAR(Sheet1[SampleDate]))),4))

View solution in original post

2 REPLIES 2
Highlighted
Solution Sage
Solution Sage

Re: Converting Week and Year for Week 53 to Show Week 01 for Next Year

You can change your calculated columns for week and year slightly, and get the desired results without having to change it every year.

 

Weeknum = CONCATENATE("",Right(CONCATENATE("0",IF(WEEKNUM(Sheet1[SampleDate]) > 52, 1, WEEKNUM(Sheet1[SampleDate]))),2))

 

Year = CONCATENATE("",Right(CONCATENATE("0", IF(WEEKNUM(Sheet1[SampleDate]) > 52, YEAR([SampleDate]) +1, YEAR(Sheet1[SampleDate]))),4))

View solution in original post

Highlighted
Helper IV
Helper IV

Re: Converting Week and Year for Week 53 to Show Week 01 for Next Year

Thanks @tarunsingla! It works!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors