Forum Discussion

Friedrich902's avatar
Friedrich902
Regular Visitor
3 years ago
Solved

Get the first element from list which is not taken

Hello to everyone,   I want to take the first element from a list in the same row which was not taken from a row with a smaller index. The Idea ist to match debit and credit bookings.   Do you k...
  • AlienSx's avatar
    3 years ago

    Hello, Friedrich902 

        s = your_table,
        lst = s[IndexMatching Elements Index],
        new_col = 
            List.Accumulate(
                lst,
                {},
                (s, c) => s & {List.Difference(c ?? {null}, List.RemoveNulls(s)){0} ? }
            ),
        result = Table.FromColumns( Table.ToColumns(s) & {new_col}, Table.ColumnNames(s) & {"Desired Result Custom Function"} )