Power BI: merge tables automatically by loading them
In some projects, I have to load new data each month and merge those new ones to the old one so every month, I have to repeat the same process manually which is to load it then to append it in Power Query Editor. The idea is to make it more automatic so my goal is just to load the data and to forget about the rests.
First thing I have to do, it is to create a default table with no data, just the header. It is my main table in which I will do everything. For that, I will click on “home -> enter data”:
For my article, I will create it with 2 columns only (those columns should match exactly with all the future tables):
![]() |
![]() |
This is the result:
I will click on “home -> transform data -> transform data” to go to Query Editor:
Click on “home -> advanced editor”:
The code looks like that:
For each new table, I will add this code:
TableToAppend1 = try XXX otherwise null,
#"Result1" = if TableToAppend1 <> null then Table.Combine({#"YYY", TableToAppend1}) else #"YYY"
NOTE:
- Replace XXX by your table name and YYY by the previous step name
- Don’t forget to add a comma at the end of the step (the red section in the picture)
For instance:
- For 1 new table:
- For 2 new tables:
No matter how many new tables I will add in my code, the result will always like that:
If I load my new table called “Table1” and refreshing “Table”, the data will show:
Now, loading the new table “Table2” and refreshing “Table”:
The disadvantage is that there is no an easy way to delete “Table1” and/or “Table2” if I don’t need them, I get this message if I do it:
To delete it, I have to go back to the “advanced editor” and remove its section:
Then I can delete properly the table and to reset everything, I have to put back as the beginning:
Interesting Topics
-
Be successfully certified ITIL 4 Managing Professional
Study, study and study, I couldn’t be successfully certified without studying it, if you are interested...
-
Be successfully certified ITIL 4 Strategic Leader
With my ITIL 4 Managing Professional certification (ITIL MP) in the pocket, it was time to go for the...
-
Hide visual and change background color based on selection
Some small tricks to customize the background colour of a text box...
-
Stacked and clustered column chart or double stacked column chart
In excel, I use a lot the combination of clustered and stacked chart...
-
Refresh Power BI
From the Power BI Service, I can set refresh but, for instance, there is no option to do it monthly or each time a change is made...
-
Power BI alerts to be sent by email from an excel file based on condition
I will explain how to send a list of emails from an excel file after creating alerts...








