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
harirao
Post Prodigy
Post Prodigy

Converting week W53 12 2020 to "Dec-2020"

Hello Team,

 

Can you please assist me how to convert weeks i.e W53 12 2020 to "Dec-2020", tried using Format its not working, data type  from source is "TEXT"

Format.PNG

Thank you

Regards,

 

1 ACCEPTED SOLUTION

@harirao , You can create a date as a

Week to Date = var _st = date(right([Weeks],4),1,1)
var _week = mid([Weeks],2,2)*1
Return _st+((_week-1)*7) -WEEKDAY(_st,2)+1

From the date you can get any format

Year of the month to format([Week to Date] ,"MMM YYYY")

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@harirao ,

In a new column like

if(SEARCH("W53",[Weeks],,0)>0, "Dec " & right([Weeks],4),[Weeks])

Hi @amitchandak,

 

Thanks for your quick response, it is working for one row, is it possible to use month mentioned in row Eg "W53 12 2020", can use only 12, 11, 10 for converting month format?

Format.PNG

 

Thanks for your help

 

Regards,

@harirao , You can create a date as a

Week to Date = var _st = date(right([Weeks],4),1,1)
var _week = mid([Weeks],2,2)*1
Return _st+((_week-1)*7) -WEEKDAY(_st,2)+1

From the date you can get any format

Year of the month to format([Week to Date] ,"MMM YYYY")

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.