Table.CombineColumns Function in Power Query

The Table.CombineColumns function merges columns using a combiner function to produce a new column. Table.CombineColumns is the inverse of Table.SplitColumns.

Syntax

Table.CombineColumns(
table as table, 
sourceColumns as list, 
combiner as function, 
column as text) as table 

Note: This function is only used to combine the text columns.

Example:

Power Query M

let
  MyTable = Table.FromRecords(
    {
      [Name = "Ashish", State = "Haryana", Marks=65],
      [Name = "Katrina", State = "Maharashtra", Marks=65],
      [Name = "Alia", State = "Uttar Pradesh", Marks=65],
      [Name = "Vicky", State = "Bihar", Marks=90],
      [Name = "Mohini", State = "Madhya Pradesh", Marks=0],
      [Name = "Meenakshi", State = "Haryana", Marks=65],
      [Name = "Esha", State = "Uttar Pradesh", Marks=50],
      [Name = "Anjali", State = "Delhi", Marks=38]
    }
  ), 
  return = Table.CombineColumns(MyTable, {"Name", "State"}, Combiner.CombineTextByDelimiter("-"), "Merged")
in
    return  

The output of the above code is shown below:

Table.CombineColumns function in Power Query