Forum Discussion

MiKeZZa's avatar
MiKeZZa
Post Patron
7 years ago
Solved

Add timecolumn to another timecolumn

I have a pbix file with 2 timecolumns coming from a CSV; 1 is a fixed value for the whole CSV (let's say 15:00:00) and the second column is chanching for every row (let's say; 00:00:01, 00:00:01, 00:...
  • Stachu's avatar
    Stachu
    7 years ago

    time is basically a fraction between 0 and 1 (24h)

    try changing the type while adding a new step:

    1) first from time to decimal

    2) from decimal to duration

    similar to this

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjS1MjAAIiUdJTANYsbqYBM3xCFuRKK4qVJsLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type time}, {"Column2", type time}}),
        #"Changed Type to decimal" = Table.TransformColumnTypes(#"Changed Type",{{"Column2", type number}}),
        #"Changed Type to duration" = Table.TransformColumnTypes(#"Changed Type to decimal",{{"Column2", type duration}})
    in
        #"Changed Type to duration"
    Did I answer your question? Mark my post as a solution!

    Proud to be a Datanaut!