Forum Discussion

gmrram's avatar
gmrram
Regular Visitor
3 years ago
Solved

Fill a specific cell value to entire column for a Table through Custom Column

Hi I tried adding a New Column to every table in the Data Column and fill the Company Name which is available in [Column]{0} in the respective table through Custom Column. However Im getting the erro...
  • AlB's avatar
    3 years ago

    Place the following M code in a blank query to see the steps. Note the only change with regard to your version is in the last step, adding custom the column.

     

    let
        Source = Excel.CurrentWorkbook(),
        #"Removed Columns" = Table.RemoveColumns(Source,{"Name"}),
        #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Content", "Data"}}),
        #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Table With Company Name", (outer)=> Table.AddColumn(outer[Data],"Company Name", each outer[Data][Column2]{0}))
    in
        #"Added Custom"

     

     

    Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.