Forum Discussion

StefanoT1982's avatar
StefanoT1982
Regular Visitor
1 year ago
Solved

Evaluating a column through steps without hardcoding the steps' names

Assume I have a simple table with 2 steps: let     Step1 = #table (type table[Names = Text.Type, Money = Int64.Type], {{"John", 1}, {"Jack", 2},{"Mary", 4} }),     Step2 = Table.Skip(Step1,1)    ...
  • AlienSx's avatar
    1 year ago
    let
        steps = 
            [
                Step1 = #table (type table[Names = Text.Type, Money = Int64.Type], {{"John", 1}, {"Jack", 2},{"Mary", 4} }),
                Step2 = Table.Skip(Step1,1)
            ],
        money_evolution = ((fields) => Record.FromList(List.Transform(fields, (x) => List.Sum(Record.Field(steps, x)[Money])), fields))(Record.FieldNames(steps))
       
    in
        money_evolution