Forum Discussion

-_-'s avatar
-_-
New Member
4 years ago
Solved

Read Cell Contents as Formula

I have cell contents that look like the following:   Item Qty A 2|1|1 B 1|1|1|1 C 0|1|1|1|1   I am trying to multiple the values together as if the "|" was a "*". Text to colum...
  • Jakinta's avatar
    4 years ago

    You can use List.Accumulate as below.

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTKqMazRNVWK1YlWcoJyjQxrDMECzkABA6AAGCrFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Item = _t, Qty = _t]),
        #"Added Custom" = Table.AddColumn(Source, "Custom", each List.Accumulate( List.Transform(Text.Split([Qty],"|"), Number.From) ,1,(s,c)=> s*c), type number)
    in
        #"Added Custom"

     

    Result