cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HishamAT
Helper I
Helper I

Converting month name to date

Hi, 

I have a column in a table as follows : 

column Name is : Month

column Data Type is : text

What i need is to convert it to data type date and with the format of MMM (Only month name).

Can you help me please on this.

Thanks

 

1 ACCEPTED SOLUTION
TomasAndersson
Solution Sage
Solution Sage

So you only have the text, and no other column with a date to use?

This calculated columns would work

Month Name = 
SWITCH(Table[Month],
   "January", Format (Date(2020,1,1), “mmm”),
   "February", Format (Date(2020,2,1), “mmm”),
//and so on for the rest of the months
)

 You would have to adjust the year according to your need. If you are able though, it would be better if you could edit the data source so there are dates to work with. This solution is not very efficient.

View solution in original post

4 REPLIES 4
TomasAndersson
Solution Sage
Solution Sage

So you only have the text, and no other column with a date to use?

This calculated columns would work

Month Name = 
SWITCH(Table[Month],
   "January", Format (Date(2020,1,1), “mmm”),
   "February", Format (Date(2020,2,1), “mmm”),
//and so on for the rest of the months
)

 You would have to adjust the year according to your need. If you are able though, it would be better if you could edit the data source so there are dates to work with. This solution is not very efficient.

This what i have and and it is a ( text ) data type , what i need is to convert this column to data type ( date ) and with the format of MMM (Only month name).

Should i create another culomn to convert it or what ?

 

HishamAT_0-1669807736414.png

Thanks 

Yes, you will need to create a new calculated column that, based on the text in "Month", returns the date you want. And then you have to format that column.

Successfully completed... Thanks 

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.