Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Stuck applying changes

Greetings dear data folks,   In my country there is problem.   Background: I work in plant business and I have to gather and process data a lot. One of the things I'm trying to achieve with the ...
  • pankajnamekar25's avatar
    1 year ago

    Hello Anonymous 

    You're experiencing a massive row explosion because you're merging two tables that both have multiple rows per key (like segment or week), leading to a many-to-many relationship. This creates a Cartesian product, which multiplies rows instead of just matching them one-to-one. To fix this, you need to clean and aggregate your data before merging—ensure only one row per key in one of the tables, remove duplicates, and only keep necessary columns. Merge in stages and monitor the row count after each step. Pre-aggregating pricing data and turning off intermediate query loads can also help reduce memory usage and speed up performance.

    Thanks

     Pankaj Namekar | LinkedIn

    If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

     

  • v-sgandrathi's avatar
    v-sgandrathi
    1 year ago

    Hi Anonymous,

     

    Thank you for your follow-up and for clearly outlining your current challenge. Your efforts to resolve this are evident, and you are correctly identifying potential causes.

    From your description, the significant increase in row count, from approximately 220K to several million suggests a many-to-many join during the merge process. This typically occurs in Power Query when both datasets contain multiple rows with the same key, resulting in a Cartesian product.

    To address this, please consider these steps:

     

    De-duplicate the key column in your reference table (Segment file):
    Verify that the table you are merging (with the "segment" column) contains only one row per unique key (e.g., Variety). Use the "Remove Duplicates" feature in Power Query to ensure this and prevent unintended row multiplication.

     

    Check the merge configuration:
    When merging, select the Left Outer Join to keep all rows from your primary dataset and bring in matching segment data. Ensure the join key is consistent in both datasets, with matching data types and no extra spaces.

     

    Preview the merge results:
    Before applying changes, review the row count in the merge preview. If there is a substantial increase, pause and examine the key columns for duplicates or mismatches.

     

    Use the merge as a lookup:
    If your goal is to add a single "segment" column, reduce the segment reference table to just the join key and segment column. Make sure it is a one-to-one mapping before merging to avoid row expansion.

    Your observation about simply wanting to add a column is valid; a one-to-one join should not increase the row count. This indicates the issue is likely due to duplicate or unmatched keys.

    You are making excellent progress with Power BI, and these challenges are common even for advanced users.

     

    Best regards,
    Sahasra
    Microsoft Fabric Community Support Team.