Forum Discussion

Leslie743's avatar
Leslie743
New Member
2 years ago
Solved

Modifying text of a duplicated row after using List.Repeat

Hello,   I'm a beginner power query user, trying to create unique records of buildings based on a user's desired building number input. In exampe, user has asked for X number of buildings, and iden...
  • mussaenda's avatar
    2 years ago

    Hi Leslie743 ,

     

    From your sample data

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dZK9DoIwFEZfxTAz0BYojP7FxcFEnQhDA4QQTSWog28vqdpyLd/QpD3n5uttbosiWAZhcNZ1M7TD7anr8cTMKsOP2/0wJ/j06rtKXcedsHzlRcXE2aiEYBeVWr6elkujPJzN43weswhwBjgn3DXJBBIxEgkSKRISCffoDek2NxPyOI8Id0GcIcGt2JIkYebp8xjwBPCU8MnFEokMiRwIEVlx7B7N4qCGS6fbaRvC/fK90vW9Uv1/xffDl28=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Building = _t, Floor = _t, Index = _t, #"QTY Building" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Building", type text}, {"Floor", type text}, {"Index", Int64.Type}, {"QTY Building", Int64.Type}}),
        #"Grouped Rows" = Table.Group(#"Changed Type", {"Building", "Floor"}, {{"Count", each _, type table [Building=nullable text, Floor=nullable text, Index=nullable number, QTY Building=nullable number]}}),
        #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([Count], "Bldg Count", 1, 1)),
        #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Index", "QTY Building", "Bldg Count"}, {"Index", "QTY Building", "Bldg Count"}),
        #"Added Custom1" = Table.AddColumn(#"Expanded Custom", "Custom", each [Building] & Number.ToText([Bldg Count]))
    in
        #"Added Custom1"