Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Add column based on organization name

Dear Community,   I have an Excel file with with 2 organization names in one column. Need to add column so it puts Org bane against its account. Account-Org Amount Organization (need to add t...
  • Ahmedx's avatar
    2 years ago

    pls try yjis code in power query

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("1ZJBDsJACEWvQmalyTcBhoHp2m0PoGl6N8/iyXRSXXZsjRshYcX7gQ/TlC4taBzPCel++zbp1GqaMSVh1d9pZe5qkRcMMcCFF0BlDSB1B7PCNV69xTYOSsYB87pwprKV08jIz/bGXVv8odOUqyOzoFqsm0wCU0dURfH3MUrfKDoI3Blc4rj3JB83Cqv939mjFatvtU9rfgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Account-Org" = _t, Amount = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Account-Org", type text}, {"Amount", type text}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if (try Number.From( [#"Account-Org"]) otherwise "i")="i" then [#"Account-Org"] else null),
        #"Filled Down" = Table.FillDown(#"Added Custom",{"Custom"})
    in
        #"Filled Down"