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
Ramees_123
Helper IV
Helper IV

Calculated column to get Date Field from Text

I am having a month YYYY field in my table and it is a pure text data type field.

 

Example :- Jan 2021, Feb 2021, Mar 2021 etc., 

 

I need to create a calculated column to convert these data to 01/01/2021, 01/02/2021, 01/03/2021, etc.,

 

How can we do it ? Please help.

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Ramees_123 

have you tried to change the date type to date in PQ?

1.PNG

 

or change the date type in column tools

2.PNG





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
ryan_mayu
Super User
Super User

@Ramees_123 

have you tried to change the date type to date in PQ?

1.PNG

 

or change the date type in column tools

2.PNG





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

Proud to be a Super User!




jdbuchanan71
Super User
Super User

@Ramees_123 

Give this a try.

Month Date = 
VAR _Year = INT ( RIGHT ( 'Table'[Month Field], 4) )
VAR _Month = 
    SWITCH (
        LEFT('Table'[Month Field],3),
        "Jan",1,"Feb",2,"Mar",3,"Apr",4,"May",5,"Jun",6,"Jul",7,"Aug",8,"Sep",9,"Oct",10,"Nov",11,"Dec",12
    )
RETURN DATE ( _Year, _Month, 1 )

jdbuchanan71_0-1636554031289.png

 

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.