Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Promoting a single row

I am pulling several poorly formatted Excel files into PowerBi, these are pulled directly from a a machine so the formatting must remain the same.    The table looks like the below:  Start Time...
  • mukulthuwal's avatar
    5 years ago

    Hi Anonymous , please paste this query in your advanced editor & check if it works according to your requirement.

     

    let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjSxMjAAIiUdJUNTOFMBig0MoUKxOtFwwYCi/JTS5BIQMzyxJLUILIyswDE3vzSvRCExJSU1BcQ3BJupFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Start Time" = _t, #"End Time" = _t, #" " = _t, #" .1" = _t, Duration = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Start Time", type time}, {"End Time", type time}, {" ", type text}, {" .1", type text}, {"Duration", type time}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[#" "]), " ", " .1"),
    #"Removed Columns" = Table.RemoveColumns(#"Pivoted Column",{" "}),
    #"Filled Down" = Table.FillDown(#"Removed Columns",{"Duration"}),
    #"Filled Up1" = Table.FillUp(#"Filled Down",{"Duration", "End Time", "Start Time"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Up1", each ([#"Product "] = "Water"))
    in
    #"Filtered Rows"