Power BI Beginner Level: 10 - Appending Tables
Richard Steinbiss
Head of Business Intelligence and Data Analytics (Power BI, AWS, Azure, Spark, Python, Kubernetes)
Short summary: You can append two tables in Power BI if they have mostly the same columns (=attributes) and you want to have the rows (=records) in one combined table. You can see this as putting two tables below each other by matching columns.
As discussed in the previous article, there are two ways of combining tables:
I already showed you how to merge tables before, now let's append append tables.
Assume that we have sales data from two different sales regions and we want to get the data into one combined table. We have mostly the same columns (attributes) but different rows (records) from the two tables.
We can simply add the records of the second table into the first table under the matching columns. Power Query will do this for us, matching by exact column names, which are case-sensitive.
Start off by loading the two tables into Power BI. You can download my sample Excel input and load the two tables with the Excel connector.
Then go into the Power Query editor (via Transform data on the Power BI Home ribbon). In the Power Query editor, choose Append Queries and then Append Queries as New.
领英推荐
Now simply select the two tables which you want to append and click ok. You could also append three or more tables if needed.
This gives us the desired result.
Note that though the order of the columns in the two input tables was not the same, Power Query matched the columns correctly. Also note that for columns which are only in one of the two input tables, e.g. the columns Only in North and Only in South, you will have missing values, denoted by null in the Power Query editor.
As for the previous article, I create a table visual to show the table in the report so there is something to see for the online report viewers. If you just want to see the data as a report creator in Power BI Desktop, you could preview the data in the Power Query editor or go to the Data view, as denoted by the green boxes.
And that’s it! I suggest you try it out for yourself. See you in the next article.
Please like, share, and subscribe and feel free to ask questions in the comments below.