Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
gmrram
Regular Visitor

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 error as shown in the snip. Please help me on this. Thank You. Please refer attached snip.PQ issue.jpg

1 ACCEPTED SOLUTION
AlB
Super User
Super User

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"

 

 

SU18_powerbi_badge

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.

 

View solution in original post

4 REPLIES 4
AlB
Super User
Super User

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"

 

 

SU18_powerbi_badge

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.

 

gmrram
Regular Visitor

Thank You Very Much!! Its working perfectly!

AlB
Super User
Super User

Hi  @gmrram 

Can you please show the actual error message?

And ideally share the pbix with the table you are working on in PQ

 

SU18_powerbi_badge

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.

 

 

gmrram
Regular Visitor

Thanks for your Reply, here is the Excel file. (link updated)

 

https://drive.google.com/drive/folders/170LTcgmwt79LqF4KId4CmiZkMT0ZjXLt

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.