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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

same column but date is not recognized

i have a column of dates in the excel in this format:

01/1/2016:01:38:19

 

So in powerbi, i spilt the column into date and time but encounter error when i tried changing the data type for date column.

"[DataFormat.Error] We couldn't parse the input provided as a Date value."

 

I tried to reformat to date in excel before importing to powerbi but same error occured.

Anyone can advice?

Thank you.

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please split the date column like this in power query.

Capture.PNG

2.PNG

 

For more details, please check the M code as below.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDUN9Q3MjA0szIwtDK2sDK0VIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "date", Splitter.SplitTextByEachDelimiter({":"}, QuoteStyle.Csv, false), {"date.1", "date.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"date.1", type date}, {"date.2", type time}})
in
    #"Changed Type1"

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please split the date column like this in power query.

Capture.PNG

2.PNG

 

For more details, please check the M code as below.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDUN9Q3MjA0szIwtDK2sDK0VIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "date", Splitter.SplitTextByEachDelimiter({":"}, QuoteStyle.Csv, false), {"date.1", "date.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"date.1", type date}, {"date.2", type time}})
in
    #"Changed Type1"

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Hi

I will try to use Power Query to split the column into two columns using the split function to fix this issue

Tomas

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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