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
WLou
Helper I
Helper I

Manually adding column to Table loaded from Query then refresh

Hi all, 

 

I have loadaed a table from power query, and wish to add column "Comment" at the end of the table to mannually commenting them Row by Row

 

Ideally I will refresh this table every now and then to se me which rows are new and need to be commented 

 

What I have reliased is, once I click refresh, the comment column no longer reference to the original row, they just all over the place

 

What's the reason and any solution to that? I have a feeling this is just another dumb question 😞

 

In the past each row has unique keyreference so I can easily tell which are new, but this time there isn't one, maybe create index mannually?  

 

Thanks in advance 

Wendy

1 ACCEPTED SOLUTION

You cannot keep an Excel column in sync with a Power Query column. If you are using a fomula that does the same thing to all rows ([Sales] * 1.05%) for example, that will work, but you are trying to keep individual comments tied to specific rows. You need to use Power Query to keep them in sync. See this file for what I've done, explained below.

  1. Create a new table in Excel that has your comments. It also must have the column(s) that will be a unique link to the specific row you want I've used a combination of the Account Number and Journal Entry based on your screenshots.
  2. Add a Comment field to your Comment table and make your comments.
  3. Select your Comment table and load it to Power Query.
  4. Click the first query in Power Query and on the Home ribbon, Merge as new.
  5. Select your comment table.
  6. Make sure the fields line up as shown here. You do this by selecting first Account Number, then Journal Entry. PQ will add the little 1/2. (You don't worry about this if you have one unique column, but here we need two columns for uniqueness)
    1. 2020-02-23 17_35_51-.png
  7. Once done, Expand the Comments table, and uncheck everything except the Comment field itself.
    1. 2020-02-23 17_36_42-Merge1 - Power Query Editor.png
  8. You can see how this looks in Power Query's Dependency View in the View Tab.
    1. 2020-02-23 17_39_50-.png
  9. Exit Power Query. make sure the first two tables are not loaded, but load the new merged table.
  10. It will look like this;
    1. 2020-02-23 17_40_23-Book1 - Excel.png

 

Note: if your original table is comeing from Power Query, and yours may be, then modify my steps as follows:

#4 - In the query you are using to put your JEs to the workbook, just Merge, not Merge as New, with the comment field.

#8 - Your dependency view will look a little different.

#9 - Make sure your comment table is not loaded. But your original query is loaded and will now bring the comment field in.

Add comments as desired, and Refresh the queries.

 

Note: You could do this with XLOOKUP() as well, but I don't like mixing query work with VLOOKUP/XLOOKUP/INDEX-MATCH stuff as it will cause you problems down the line as you try to integrate more in, or you decided to move this to the Data Model or Power BI where no Excel functions work. Once in Power Query, stay in Power Query. 👍



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

4 REPLIES 4
ahmedoye
Resolver III
Resolver III

If you could share some pictures showing your table and the query steps you currently have, it will be easier to help with this request. @WLou 

See example below 

bEFORE.jpg

the left 4 columns are part of the table loaded from power query

 

the last coloumn is a manually added comment section after data gets loaded 

 

once it has been refreshed, the comment section changed its order 

After.jpg

 

 

You cannot keep an Excel column in sync with a Power Query column. If you are using a fomula that does the same thing to all rows ([Sales] * 1.05%) for example, that will work, but you are trying to keep individual comments tied to specific rows. You need to use Power Query to keep them in sync. See this file for what I've done, explained below.

  1. Create a new table in Excel that has your comments. It also must have the column(s) that will be a unique link to the specific row you want I've used a combination of the Account Number and Journal Entry based on your screenshots.
  2. Add a Comment field to your Comment table and make your comments.
  3. Select your Comment table and load it to Power Query.
  4. Click the first query in Power Query and on the Home ribbon, Merge as new.
  5. Select your comment table.
  6. Make sure the fields line up as shown here. You do this by selecting first Account Number, then Journal Entry. PQ will add the little 1/2. (You don't worry about this if you have one unique column, but here we need two columns for uniqueness)
    1. 2020-02-23 17_35_51-.png
  7. Once done, Expand the Comments table, and uncheck everything except the Comment field itself.
    1. 2020-02-23 17_36_42-Merge1 - Power Query Editor.png
  8. You can see how this looks in Power Query's Dependency View in the View Tab.
    1. 2020-02-23 17_39_50-.png
  9. Exit Power Query. make sure the first two tables are not loaded, but load the new merged table.
  10. It will look like this;
    1. 2020-02-23 17_40_23-Book1 - Excel.png

 

Note: if your original table is comeing from Power Query, and yours may be, then modify my steps as follows:

#4 - In the query you are using to put your JEs to the workbook, just Merge, not Merge as New, with the comment field.

#8 - Your dependency view will look a little different.

#9 - Make sure your comment table is not loaded. But your original query is loaded and will now bring the comment field in.

Add comments as desired, and Refresh the queries.

 

Note: You could do this with XLOOKUP() as well, but I don't like mixing query work with VLOOKUP/XLOOKUP/INDEX-MATCH stuff as it will cause you problems down the line as you try to integrate more in, or you decided to move this to the Data Model or Power BI where no Excel functions work. Once in Power Query, stay in Power Query. 👍



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Very helpful 

 

Thank you @edhans 

 

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.

Top Solution Authors
Top Kudoed Authors