I am using Power Query to pull data from a SQL database into Excel as a simple table.
The intent of this is to record comments in a manual column (not part of the SQL database) for the various records pulled into the table, and then refresh the table week-over-week to get updated data for each record but maintain the comments from previous weeks.
I was able to successfully write the query and retrieve the data, but whenever I sort the data and then refresh the query, my manually added comments become misaligned.
I have checked the "Preserve column sort/filter/layout" option on the External Data Properties window for the query, and filtering seems to work fine (if I only filter and add manual comments, refreshing the dataset does not alter the placement of the comments) and yet sorting does not work.
When the SQL query is run, the records are sorted by a key column (wherein the value for each record is unique), but I cannot find a way in the Power Query editor to force the refreshed data to align to this field.
Example per Wedge's Response:
Step 3. Sort differently than original query (not same as ORDER BY)
Step 4. Refresh the original SQL Query
As you can see in the example, the "Test" comment is aligned to a different PurchaseOrderLineID after I refreshed the SQL Query.
I have attempted to create a "From Table" query (from my SQL output table) and Merge that with my original SQL query as seen below, but I am still having the same issue.