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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.