Forum Discussion

Jacob1832's avatar
Jacob1832
Frequent Visitor
4 years ago
Solved

Add a row based on conditions

My data set has a state column. I just want to add a row in my data set if the state column doesnt contain 'TX' in one of its rows. I dont care the method.  If it was possible to add it straight to ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Jacob1832 ,

     

    Try to use the Table.InsertRows in the Power Query Editor.

    In the advanced editor, like below.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTI0MFCK1YlWSgKyjaDsZCDbGMSOBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [state = _t, value = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"state", type text}, {"value", Int64.Type}}),
        Custom1 = Table.InsertRows(#"Changed Type",2, { [state = "d", value = 400] })
    in
        Custom1

     

    Table.InsertRows - PowerQuery M | Microsoft Docs

    How can I manually add a row to an existing table in Power Query? ~ Hey Niels!

     

     

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.