Forum Discussion

SaaM's avatar
SaaM
Helper II
5 years ago
Solved

Refactor a function

Hello,   I am trying to refactor this function that I apply on 10 differents columns.   fnConcatenate = (tbl as table) => Table.AddColumn(tbl, "field_1_combined", each if [id]>[linenumber] then ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    try

     

     

     

    fnConcatField = (tbl as table, field as text) => Table.AddColumn(tbl, field & "_combined", each 
                                    if [id]>[linenumber] then Text.Combine( Table.Column(Table.SelectRows(tbl, (sel)=> sel[key] = [key] and sel[id]>= [id]), field)) else Record.Field(_, field))

     

     

    try something like this (I haven't tested it)