Forum Discussion

timoetzold's avatar
timoetzold
Regular Visitor
6 years ago
Solved

Conditionally Replacing Cell Values

Hi I must be missing something in all the posts about Replacing Values. I have the below table (it is of course bigger) and I need to replace the Values that only have a "1" in Colum [Custom] with t...
  • Mariusz's avatar
    Mariusz
    6 years ago

    Hi timoetzold 

     

    Try applying this steps.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs7PTcrMS03R9U0tKcpM1g1JTMpJ1Y03MjC0NDQ0sjQyMLLUq8gprlDSUTJUitUhSYNWZH5pkUJOfnJiSWZ+noK+QmZeSmlxSVGllYKjkzNxphkbKGgYapLoBFRNYGccWoDdIS6ubsSaSbIjiHKAu4cnkeYZkuoAQ6Ic4OXtQysHGJGtAa+Lff38yXBALAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, Custom = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Custom", type text}}),
        #"Replaced Value" = Table.ReplaceValue(#"Changed Type","1",null,Replacer.ReplaceValue,{"Custom"}),
        #"Sorted Rows" = Table.Sort(#"Replaced Value",{{"Name", Order.Ascending}, {"Custom", Order.Ascending}}),
        #"Filled Up" = Table.FillUp(#"Sorted Rows",{"Custom"})
    in
        #"Filled Up"

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.