Forum Discussion

Capounet's avatar
Capounet
Copper Contributor
May 17, 2023

how to change values from one table to another

I have two tables that share the same columns structure (43 columns with 1 serial key column).

Table A: raw extract but can contain false value.
Table B: contain a few lines with correction for specifi cell. The id is specified, then the value to change are mentionned in their specific cells, the reste are nulls.

I tried to make a full outer join then 43 conditional add columns (if B is not null, then B else A). Once the columns are added i deleted the previous columns.

That proces is way too slow (no surprise) but i can't get my hands on a "How to" for that kind of precedure with power query.

Any clue ?

  • Capounet See if the attached file contains the PQ solution that works for you. It involves unpivoting each table first, then merge and expand and then add one custom column. Remove some columns and pivot again to come up with the desired result. It's all done by clicking in the UI. No complex M-coding required. It should not affect performance all that much on tables with 43 columns. But give it a try.

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    Capounet See if the attached file contains the PQ solution that works for you. It involves unpivoting each table first, then merge and expand and then add one custom column. Remove some columns and pivot again to come up with the desired result. It's all done by clicking in the UI. No complex M-coding required. It should not affect performance all that much on tables with 43 columns. But give it a try.

    • Capounet's avatar
      Capounet
      Copper Contributor
      Riny_van_Eekelen That is exactly what i needed. You just learn me a very interresting process. Thank you so much for the time given 😉 🙂

Share

Resources