Forum Discussion

MattAdams's avatar
MattAdams
Icon for Helper I rankHelper I
8 years ago
Solved

Need help with merged columns and data types

I have a column named resolvedondt and one called resolvedontm from a database. Resolvedondt is a date format and the other is a text (ABC) type. When I do a merge to combine them as separated by a s...
  • MarcelBeug's avatar
    MarcelBeug
    8 years ago

    You can first convert your text column to type time and then merge the 2 columns (first select the 2 columns) by using the Combine Date and Time functionality.

     

    This is the generated code (with sample data in the Source step):

     

    let
        Source = #table(type table[resolvedondt = date, resolvedontm = text],{{#date(2017,5,10),"3:39 PM"}}),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"resolvedontm", type time}}),
        #"Merged Date and Time" = Table.CombineColumns(#"Changed Type", {"resolvedondt", "resolvedontm"}, (columns) => List.First(columns) & List.Last(columns), "Merged")
    in
        #"Merged Date and Time"

     

    Here you can find Combine Date and Time: