Forum Discussion

Zdenek_Moravec's avatar
Zdenek_Moravec
Brass Contributor
Jan 21, 2021
Solved

Combine power query output table with manually maintained column in one excel table

I transform and load a CSV file into an excel sheet using Power Query:

Column1

Column2.1

Column2.2

01.01.2021

A

BC

01.02.2021

M

NO

01.03.2021

X

YZ

Customer wants to maintain next column of this table ("My Col") manually:

Column1

Column2.1

Column2.2

My col

01.01.2021

A

BC

A is first

01.02.2021

M

NO

M is second

01.03.2021

X

YZ

X is last

So far so good. The problem is that the next day, the CSV file can come in different order of records. And after Data-Update all, the table is updated in the this new order, but the manual column remains in the original order. Then we have data mismatch:

Column1

Column2.1

Column2.2

My col

01.02.2021

M

NO

A is first

01.03.2021

X

YZ

M is second

01.01.2021

A

BC

X is last

What is the correct process of combining power query table columns with manually maintained columns?
Thank You!

    • Budhika 

      Not sure I understood what do you mean exactly. If you add columns to the table returned by Power Query and your date have unique ID (or you may create it) - yest, it works.

    • acemats's avatar
      acemats
      Copper Contributor

      Hi Riny_van_Eekelen, I am running into what I'm sure is a dumb mistake but I can't figure where I'm going wrong - I'm attempting this process but keep ending up with 3 tables instead of two when trying to follow your steps

       

      1. "Create First Table (Source)" - Table 1

      2. "Query it and load to...name (Source_2)" - Table 2

      3. "Query table (Source_2), now including Notes" - Table 3

       

      It seems that following the process I should only be ending up with two tables Source and Source_2, but again I keep ending up with 3 - Any help would be appreciated, thanks! 

       

      • Riny_van_Eekelen's avatar
        Riny_van_Eekelen
        Platinum Contributor

        acemats Difficult to help without seeing what you are doing. Can you share a link (Onedrive or similar) to you file?

    • Tdotnotbot's avatar
      Tdotnotbot
      Copper Contributor

      Riny_van_Eekelen 

      I am a bit of novice but am able to follow. In your example, both sources are existing tables. Is it possible to replicate this if the original source is a file in a folder? 

      • Riny_van_Eekelen's avatar
        Riny_van_Eekelen
        Platinum Contributor

        TdotnotbotThis relates to a rather old post and I believe it relates to connecting to one source and then adding information to it manually, and keep it synchronised with the original source data. It doesn't really matter where the original file sits. What exactly are you looking at?

    • SergeiBaklan's avatar
      SergeiBaklan
      MVP

      Riny_van_Eekelen , I modified a bit, hope self-explainable

       

      let
          Source  = Excel.CurrentWorkbook(){[Name="Source"]}[Content],
          Source3 = Excel.CurrentWorkbook(){[Name="Source3"]}[Content],
          SourceColumns   = Table.ColumnNames(Source),
          SourceColumns3  = Table.ColumnNames(Source3),
          FirstTime = List.ContainsAll(SourceColumns, SourceColumns3),
          Return = if FirstTime then Source else
              Table.Join(
                  Source,  SourceColumns,
                  Source3, SourceColumns
              )
      in
          Return

       

      Another table in your file.

      • FranzVerga's avatar
        FranzVerga
        Copper Contributor

        SergeiBaklan I didn't understand the use of the third table and how does it integrates with the rest of the solution...

Resources