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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Recoba88
Helper III
Helper III

Overwrite columns

Hi,

 

When I add column only in excel (the data loaded from power query) and after it I add another column in power query. The column from power query overwrites the column I added in excel.

 

 

How can I change it?

 

Thanks!

 

1 ACCEPTED SOLUTION

In that case you need to merge your table (with comments) and the information from Sharepoint in a query which sends it output back to your table (which serves both as input and as output).

 

In order to do that, you need to have a key column (or a set of key columns) you can use to merge both tables.

 

So your query structure is like:

get table from Sharepoint

merge with Excel table and expand (only your comment column so the comment will be added to the table from Sharepoint)

 

And the output of this query is written to the Excel table.

 

Edit: example of a working query how it looks like in the end.

It requires some steps to set it up, as illustrated in the video that I linked in a previous post.
The name of the query is ExcelTable, so the output is used as input with the next refresh.

 

let
    Source = SharepointTable,
    TableWithComments = Excel.CurrentWorkbook(){[Name="ExcelTable"]}[Content],
    #"Merged Queries" = Table.NestedJoin(Source,{"Header 1"},TableWithComments,{"Header 1"},"NewColumn",JoinKind.LeftOuter),
    #"Expanded NewColumn" = Table.ExpandTableColumn(#"Merged Queries", "NewColumn", {"Comments"}, {"Comments"})
in
    #"Expanded NewColumn"

 

 

Specializing in Power Query Formula Language (M)

View solution in original post

12 REPLIES 12

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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