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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Converting Number to Date - met with error

Hi all,

 

 Apologies if this specific instance has been answered before but I couldn't find the problem when I searched the forums.

 

I have imported an excel spreadsheet into Power BI to make a simple report, and I am trying to convert the following column from a number to a date 

 

custerdome_0-1662459252636.png

 

However, when I go to Change Type -> Date it gives me the following error:

 

custerdome_1-1662459326346.png

 

Would anyone have any idea why this is? 

 

Thanks!

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

Try this in a new custom column:

#date(
    Number.From(Text.Start(Text.From([assignment_start]), 4)),
    Number.From(Text.Range(Text.From([assignment_start]), 4, 2)),
    Number.From(Text.End(Text.From([assignment_start]), 2))
)

 

I get the following output:

BA_Pete_0-1662468490336.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

Power Query understands this format if you're converting from text but not from an integer, so another approach is to transform the column like this:

Table.TransformColumns(#"Prev Step", {{"assignment_start", each Date.From(Text.From(_)), type date}})
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

Try this in a new custom column:

#date(
    Number.From(Text.Start(Text.From([assignment_start]), 4)),
    Number.From(Text.Range(Text.From([assignment_start]), 4, 2)),
    Number.From(Text.End(Text.From([assignment_start]), 2))
)

 

I get the following output:

BA_Pete_0-1662468490336.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

This worked, thank you so much Pete!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.