Forum Discussion

babuInba's avatar
babuInba
Frequent Visitor
5 years ago
Solved

Convery sub header as column in power query

Hi Experts,

I would like to identify sub header and update as column value, looking for solution given below in power query

Thanks in advance.

 

 

  • babuInba 

    Add a conditional column, fill down and filter the price <> null. You can paste the below code on a new Blank Query and check the steps

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcisqzSwpVtJRUorViVZyLCjISQVyDA3AXP+ixLx0EN8Uwg9LTU8tSUzKSYVrCMnPTSzJB/KMoTryMvPzgFwjIDcWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product = _t, Price = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Product", type text}, {"Price", Int64.Type}}),
        #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Category", each if [Price] = null then [Product] else null),
        #"Filled Down" = Table.FillDown(#"Added Conditional Column",{"Category"}),
        #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Price] <> null))
    in
        #"Filtered Rows"

     

     



1 Reply

  • babuInba 

    Add a conditional column, fill down and filter the price <> null. You can paste the below code on a new Blank Query and check the steps

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcisqzSwpVtJRUorViVZyLCjISQVyDA3AXP+ixLx0EN8Uwg9LTU8tSUzKSYVrCMnPTSzJB/KMoTryMvPzgFwjIDcWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product = _t, Price = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Product", type text}, {"Price", Int64.Type}}),
        #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Category", each if [Price] = null then [Product] else null),
        #"Filled Down" = Table.FillDown(#"Added Conditional Column",{"Category"}),
        #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Price] <> null))
    in
        #"Filtered Rows"