Forum Discussion

Atlsql's avatar
Atlsql
Frequent Visitor
5 years ago
Solved

Change in Index After Expanding Merged Table Columns.

I cannot explain why this is happening.  I have two tables that I've created Indexes on, and am attempting to merge them based on Index = Index -1.   This all works great, and the indexing seems t...
  • edhans's avatar
    5 years ago

    Before you do the merge, wrap both tables in Table.Buffer() and see if that helps. To do that:

    • Go to each table
    • Go to the last step
    • Go to the formula bar. Whatever is there, add "Table.Buffer(" on the front, and another ")" on the end.
    • Repeat with 2nd table
    • then do the merge.

    What I suspect is happening is your index is based on how data is sorted, and sorts in Power Query can be affected by other data, like data coming from a merge. Table.Buffer protects from that. It also breaks any Query folding, so if you are connecting to a SQL DB or other RDBM, be aware of that potential performance hit.