Forum Discussion
Column with number/text for date
Hello guys, how are you? I need help, I have a table and I need to change a column of number/text for date but when I try to change a error is showing:
Can someone help me?
Thank you all!
7 Replies
- nandicResident Rockstar
There is a problem as data is integer type in format yyyymmdd, Power Query can't recognize it as date.
I added new column using this formula:
Date.FromText(Text.Start(Number.ToText([Date Key]),4) & "-" & Text.Range(Number.ToText([Date Key]),4,2) & "-" & Text.End(Number.ToText([Date Key]),2))
After that, just change type of new column to date.Example:
- AnonymousNot applicable
Hi diegolima ,
you should change column type from number to text and then change to date.
To give an idea have a look here:
let Origine = Excel.Workbook(File.Contents("C:\Users\abcdef\OneDrive - TIM\MyD2020\BI\date from number.xlsx"), null, true), Tabella2_Table = Origine{[Item="Tabella2",Kind="Table"]}[Data], #"Modificato tipo" = Table.TransformColumnTypes(Tabella2_Table,{{"Date", type text}, {"Country", Int64.Type}}), toDate=Table.TransformColumns(#"Modificato tipo", {"Date", Date.FromText}) in toDate - v-alq-msftCommunity Support
Hi, diegolima
Power query date format is based on your system region setting, you can't manually modify it and keep date type in power query side. I'd like to suggest you refer to the similar thread to see if it helps.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.