Forum Discussion

LucileD's avatar
LucileD
Frequent Visitor
1 year ago
Solved

replacing value dynamic column Table.ReplaceValue

Hi all, I am trying to replace blank cell by a Y but the column I want to do this replacement is contained into each of my Section cell ( dynamic). In my original file I have around 3-4000 row, and ...
  • ZhangKun's avatar
    1 year ago
    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCjY0VdJRigRiGBWrAxI1gnKhMlBRY/1gQxNUmUiYFE5jMEwxhfJQTEYViwUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Section = _t, S12 = _t, S13 = _t, S14 = _t, S15 = _t]),
        Result = 
        Table.FromRecords(List.Transform(
            Table.ToRecords(Source), 
            (row) => List.Accumulate(
                Text.Split(row[Section], "/"), 
                row, 
                // [A = 1, B = 2] & [A = 5] => [A = 5, B =2]
                // [B = 2] & [A = 5] => [A = 5, B =2]
                (s, v) => s & Record.AddField([], v, "Y")
            )
        ))
    in
        Result