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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
hallang
Frequent Visitor

Changing text to date column not working

Hi,

I have added in a formula to convert a column from DD MMMM YYYY to MMMM YYYY.  I have added a column to do this but when I try and change the data type to 'Date' its saying it cannot convert it -

 

hallang_0-1724336006303.png

can anyone help with this?

Thanks

 

1 ACCEPTED SOLUTION

The null values are the issue. 
So let's try this...

Month_Year = 
DATEVALUE(
    IF(
        ISBLANK([End]),
        BLANK(),
        FORMAT([End], "MMMM YYYY")
    )
)




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

Proud to be a Super User!





View solution in original post

10 REPLIES 10
jgeddes
Super User
Super User

Have you tried using the DATEVALUE function?
Learn - DATEVALUE() 





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

Proud to be a Super User!





Still getting the same error 😞

Month_Year = 
DATEVALUE(
    FORMAT('Absence Data'[End], "MMMM YYYY")
)

Does this get you the result you need? 





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

Proud to be a Super User!





Nope still getting the same error 😞

Alrighty. What happens when you use...

FORMAT('Absence Data'[End], "MMMM YYYY")

without wrapping it in the DATEVALUE()?





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

Proud to be a Super User!





that formula works but when I try and change the format of that to date rather than text I get an error.  Can I not change this column so it behaves like a date column?

You can absolutely change the column type to date. Based on the continued reappearance of the error I am thinking that there is/are values in your 'End' column that are not playing nice. 
Your initial screen shot did not contain any data in the 'End' column so I have been making assumptions that the data in the 'End' column was sound. My suggestion at this point would be to review the contents of that column to ensure that there are no anomalies.





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

Proud to be a Super User!





so the 'end' is a date field, the only thing I can see in it is it has 'null' values but it needs to as on some rows this will be blank

The null values are the issue. 
So let's try this...

Month_Year = 
DATEVALUE(
    IF(
        ISBLANK([End]),
        BLANK(),
        FORMAT([End], "MMMM YYYY")
    )
)




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

Proud to be a Super User!





Yes that worked! Thank you! 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors