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

time and date column in one

I have two different columns

In the first: Date

For example: 19.06.2018

 

In the second: Time

For example: 09:49:40

 

For my analysis I need the following in one collum: 19.06.2018 09:49:40

 

Can someone help me and tell me how can I combine these two collums?

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can use Transform > Merge Columns in Query editor, below is the M code and attached file with example.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMrTUMzDTMzIwtFDSUTKwtDIBIgOl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t, time = _t]),
    #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(Source, {{"date", type text}, {"time", type text}}, "en-GB"),{"date", "time"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"datetime"),
    #"Changed Type" = Table.TransformColumnTypes(#"Merged Columns",{{"datetime", type datetime}})
in
    #"Changed Type"

 

Or add a column with DAX expression.

datetime = 'Table DAX'[date] + 'Table DAX'[time]
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

View solution in original post

3 REPLIES 3
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can use Transform > Merge Columns in Query editor, below is the M code and attached file with example.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMrTUMzDTMzIwtFDSUTKwtDIBIgOl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t, time = _t]),
    #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(Source, {{"date", type text}, {"time", type text}}, "en-GB"),{"date", "time"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"datetime"),
    #"Changed Type" = Table.TransformColumnTypes(#"Merged Columns",{{"datetime", type datetime}})
in
    #"Changed Type"

 

Or add a column with DAX expression.

datetime = 'Table DAX'[date] + 'Table DAX'[time]
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

Anonymous
Not applicable

Thank you! @Mariusz 

Glad I could help! have a nice day @Anonymous 

 

Best Regards,
Mariusz

Please feel free to connect with me.
Mariusz Repczynski

 

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.