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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
Anonymous
Not applicable

Months are not reflected as dates

Hi, I hope you can help me with the following. I have a column with the names of the months. When I change the data type from text to date, I get errors. I have already tried to change it by clicking on 'Change type' --> Using locale but that does not seem to be the problem. Any other suggestions on how to fix this? Thanks! 

Slingen_0-1640698968865.png

 

1 ACCEPTED SOLUTION

You could create a "Custom Column" using this code below:

 

Date.FromText(
Number.ToText(
if [Month] = "January" then 1
else if [Month] = "February" then 2
else if [Month] = "March" then 3
else if [Month] = "April" then 4
else if [Month] = "May" then 5
else if [Month] = "June" then 6
else if [Month] = "July" then 7
else if [Month] = "August" then 8
else if [Month] = "September" then 9
else if [Month] = "October" then 10
else if [Month] = "November" then 11
else if [Month] = "December" then 12
else null
)
& "/1/"
& Number.ToText(Date.Year([Year]))
)

 

Then you should be able to change the data type of that new column to Date.

 

-Steve

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thanks! My problem is that I import another table with a date column (year and month) which is recognized as a date. This is the date column from my other table. Because this table recogizes the month as a date, I can not combine the data from the two tables in one visual. I hope my explanation makes sense... Any idea how to fix this? 

Slingen_0-1640707041879.png

 

You could create a "Custom Column" using this code below:

 

Date.FromText(
Number.ToText(
if [Month] = "January" then 1
else if [Month] = "February" then 2
else if [Month] = "March" then 3
else if [Month] = "April" then 4
else if [Month] = "May" then 5
else if [Month] = "June" then 6
else if [Month] = "July" then 7
else if [Month] = "August" then 8
else if [Month] = "September" then 9
else if [Month] = "October" then 10
else if [Month] = "November" then 11
else if [Month] = "December" then 12
else null
)
& "/1/"
& Number.ToText(Date.Year([Year]))
)

 

Then you should be able to change the data type of that new column to Date.

 

-Steve

Anonymous
Not applicable

Hi Steve, 

Thanks a lot! This solved my problem. 

amitchandak
Super User
Super User

@Anonymous , You can not convert month name to date.

 

In case you need a sorting correction, create a sort column with a month number and mark that as the sort column

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.