March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have a column containg text and date in power query, how do I copy text values only to new column and date values only to another column. I need this information to be in seperate columns. Thank you for your help.
Solved! Go to Solution.
You should copy the formula as it is rather than writing.
You put one comma after null and also ommitted try part. Copy and paste the below formula
= try if Value.Is(DateTime.From([Opened]), type datetime) then null else [Opened] otherwise [Opened]
Thank You so much it worked
Use below formulas assuming your column name is Data
for date part
= try Date.From(DateTime.From([Data])) otherwise null
for text part
= try if Value.Is(DateTime.From([Data]), type datetime) then null else [Data] otherwise [Data]
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkxK1lGoqKxSitWJVjLTt9Q3MjAyUjA0sjIytTK1VAjwBUuY6hvBZKzMrQxNFRwh4mDC0MjYpKikUik2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Data = _t]),
#"Added Custom" = Table.AddColumn(Source, "Date Part", each try Date.From(DateTime.From([Data])) otherwise null, type date),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Text Part", each try if Value.Is(DateTime.From([Data]), type datetime) then null else [Data] otherwise [Data], type text)
in
#"Added Custom1"
Thank you so much for the solution,
Date.From(DateTime.From([Data])) otherwise null
Your assitance is much appreciated.
You should copy the formula as it is rather than writing.
You put one comma after null and also ommitted try part. Copy and paste the below formula
= try if Value.Is(DateTime.From([Opened]), type datetime) then null else [Opened] otherwise [Opened]
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.