Power BI Beginner Level: 10 - Appending Tables

Power BI Beginner Level: 10 - Appending Tables

Table of Contents | Sample Input | Power BI Report File

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:

  • Merging, i.e. putting the tables beside each other
  • Appending, i.e. putting the tables below each other

No alt text provided for this image
There are two ways of combining tables: Merging and appending.

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.

No alt text provided for this image
This is the input data for the Append exercise.

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.

No alt text provided for this image
Load the two tables from the Excel file into Power BI.

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.

No alt text provided for this image
Append the two queries together.

Now simply select the two tables which you want to append and click ok. You could also append three or more tables if needed.

No alt text provided for this image
Select the two tables and click ok.

This gives us the desired result.

No alt text provided for this image
The appended table in Power Query.

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.

No alt text provided for this image
Displaying the appended table as a table visual in the Power BI report.

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.

Next article:?Basic Transformations in Power Query

要查看或添加评论,请登录

Richard Steinbiss的更多文章

社区洞察

其他会员也浏览了