Connecting Data via the Append Command

Introduction to PowerQuery Linking and Organizing Data
6 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€64.93
List Price:  €92.76
You save:  €27.83
£55.85
List Price:  £79.79
You save:  £23.94
CA$95.75
List Price:  CA$136.80
You save:  CA$41.04
A$105.88
List Price:  A$151.27
You save:  A$45.38
S$94.72
List Price:  S$135.33
You save:  S$40.60
HK$546.91
List Price:  HK$781.33
You save:  HK$234.42
CHF 63.46
List Price:  CHF 90.66
You save:  CHF 27.20
NOK kr757.20
List Price:  NOK kr1,081.77
You save:  NOK kr324.56
DKK kr484.44
List Price:  DKK kr692.10
You save:  DKK kr207.65
NZ$116.32
List Price:  NZ$166.18
You save:  NZ$49.85
د.إ257.06
List Price:  د.إ367.25
You save:  د.إ110.18
৳7,685.71
List Price:  ৳10,980.05
You save:  ৳3,294.34
₹5,844.92
List Price:  ₹8,350.25
You save:  ₹2,505.32
RM331.68
List Price:  RM473.85
You save:  RM142.17
₦99,352.90
List Price:  ₦141,938.80
You save:  ₦42,585.90
₨19,422.12
List Price:  ₨27,747.07
You save:  ₨8,324.95
฿2,569.35
List Price:  ฿3,670.66
You save:  ฿1,101.30
₺2,257.93
List Price:  ₺3,225.75
You save:  ₺967.82
B$359.91
List Price:  B$514.18
You save:  B$154.27
R1,286.96
List Price:  R1,838.60
You save:  R551.63
Лв127.01
List Price:  Лв181.45
You save:  Лв54.44
₩95,596.49
List Price:  ₩136,572.27
You save:  ₩40,975.78
₪260.69
List Price:  ₪372.44
You save:  ₪111.74
₱4,021.38
List Price:  ₱5,745.07
You save:  ₱1,723.69
¥10,900.73
List Price:  ¥15,573.14
You save:  ¥4,672.41
MX$1,172.87
List Price:  MX$1,675.60
You save:  MX$502.73
QR254.79
List Price:  QR364.01
You save:  QR109.21
P953.47
List Price:  P1,362.16
You save:  P408.69
KSh9,270.57
List Price:  KSh13,244.24
You save:  KSh3,973.67
E£3,317.36
List Price:  E£4,739.29
You save:  E£1,421.93
ብር4,002.19
List Price:  ብር5,717.66
You save:  ብር1,715.47
Kz58,536.37
List Price:  Kz83,626.97
You save:  Kz25,090.60
CLP$64,740.75
List Price:  CLP$92,490.75
You save:  CLP$27,750
CN¥505.65
List Price:  CN¥722.39
You save:  CN¥216.74
RD$4,053.41
List Price:  RD$5,790.83
You save:  RD$1,737.42
DA9,418.25
List Price:  DA13,455.22
You save:  DA4,036.97
FJ$158.92
List Price:  FJ$227.04
You save:  FJ$68.12
Q543.91
List Price:  Q777.05
You save:  Q233.14
GY$14,591
List Price:  GY$20,845.18
You save:  GY$6,254.17
ISK kr9,761.50
List Price:  ISK kr13,945.60
You save:  ISK kr4,184.10
DH700.89
List Price:  DH1,001.31
You save:  DH300.42
L1,242.28
List Price:  L1,774.76
You save:  L532.48
ден4,000.60
List Price:  ден5,715.39
You save:  ден1,714.79
MOP$561.14
List Price:  MOP$801.67
You save:  MOP$240.52
N$1,290.58
List Price:  N$1,843.76
You save:  N$553.18
C$2,565.92
List Price:  C$3,665.76
You save:  C$1,099.83
रु9,317.52
List Price:  रु13,311.31
You save:  रु3,993.79
S/259.50
List Price:  S/370.73
You save:  S/111.23
K270.29
List Price:  K386.14
You save:  K115.85
SAR262.49
List Price:  SAR375.01
You save:  SAR112.51
ZK1,908.05
List Price:  ZK2,725.90
You save:  ZK817.85
L323.12
List Price:  L461.62
You save:  L138.50
Kč1,619.42
List Price:  Kč2,313.56
You save:  Kč694.13
Ft25,184.29
List Price:  Ft35,979.10
You save:  Ft10,794.81
SEK kr758.43
List Price:  SEK kr1,083.53
You save:  SEK kr325.09
ARS$61,764.46
List Price:  ARS$88,238.72
You save:  ARS$26,474.26
Bs483.72
List Price:  Bs691.07
You save:  Bs207.34
COP$271,807.63
List Price:  COP$388,313.26
You save:  COP$116,505.63
₡35,677.52
List Price:  ₡50,970.07
You save:  ₡15,292.55
L1,718.38
List Price:  L2,454.93
You save:  L736.55
₲523,713.94
List Price:  ₲748,194.84
You save:  ₲224,480.90
$U2,690.81
List Price:  $U3,844.18
You save:  $U1,153.37
zł279.12
List Price:  zł398.76
You save:  zł119.64
Already have an account? Log In

Transcript

It's quite common to have multiple data sets of the same type that are split apart for size management reasons, such as having January sales stored separately from March sales or June sales. In this lesson, I'm going to introduce you to the append command within Power Query. With this command, we'll be able to combine multiple datasets together end to end, as if you were stacking them on top of each other. In simple terms, you can think about the append command as if you're copying one dataset and pasting it at the bottom of another data set. While following a very simple rule. You'll be pasting the data so that each column header from one table will match the column table header from the other.

Let's use these two tables and append them together as a demonstration. The left table has a list of fruits and a list of stores. While our right table has a list of fruits and a list of store name. Imagine pending the right table to the left table, that means that we'll be copying and pasting each column from the right to the appropriate column on the left. Appropriate column is defined pretty strictly the names must match exactly. So how do you think this scenario will play out?

Since this is a small data set, let's perform the upended Excel the same way the Power Query append would, each table has a column called fruits, so it will match up pretty perfectly meaning I can copy the fruits on the right immediately into the fruits on the left. The other column does not match stores is not the same as store name. How does Power Query handle this mismatch? It's actually going to do two different steps. The first step is extending the stores values to include a blank entry for each of the fruits. The second step is going to be to add a new column called store name to the right of stores.

And in this column, that's where the store name data from our second table will be sword. This action is performed for each column in each table, matching column Get stacked together, while mismatched columns will be placed in their own fields. This creates a single table with all of our information even if it's not quite oriented the way we would like it to be. Having seen this basic concept in action within Excel, let's take it over to our query editor and perform an append to there. We have the same tables we use just a moment ago, but each has been loaded into a Power Query. I'm going to right click and edit the stores query to serve as a starting point appending queries together as a matter of just a few mouse clicks.

The append queries button can be found on the Home tab, and clicking on it will initiate a wizard consisting of two options, two tables and three or more tables. The general functionality between the two is the same, but the three or more options interface will let you append more than one table together at a time. I'm going to start with the two tables approach. And once at this point, all you need to do is select the table that you want to attend from the drop down. Once you've done this pressing OK we'll Have the data get appended to the end. For this example, we can see how a new store name column has been added.

And all of our information is appended to the very end. So the two table options pretty quick and easy. How much more challenging is the three or more option. Let's go ahead and delete this step and redo it. This time, I'm going to select the three or more tables option. Instead of having a drop down here, I have two lists.

The left side shows all of the tables that are in my workbook that I can use for this append command. Note that it will label the query you're currently in and included on the right by default. The right side shows the list of tables that you selected to append together. to replicate our prior command, we need to add the Z store names table to the list on the right by selecting the left and then clicking the Add button in the middle. Once both queries are listed, pressing OK will create the same output we had moments ago when using the two table option. quite clearly the three or more table approach is almost As easy as the two table approach to us, let's go and re edit the command and bolt surprise, the editor has condensed our command to a two table append command.

Let's change this back to three or more. I'm going to add another copy of this east or names data from the left to the right. And once I've done this, I'm going to press OK. In our data set, we now show two separate copies of the same data as having been upended once for each of the entries we placed in the append command. One issue with our append command is that we've left two columns disjointed, when we really know that they should be a single column of information. For a scenario like this, we'd like to combine them together.

When one column is blank, use the other column and vice versa. To do this, I can select both columns by holding the Ctrl key and clicking on each one. Once I have them selected, on the transform tab, you can find the merge columns command. This command will bring up a new prompt to help you To figure out how to combine the columns together, whether to separate the data with a separator, and what column name to use, This command will place the first column on the left, then add the separator before adding the second column to the right. So commas could be used to create a name field. In this case, I do not want any separators since I have either a null value or the store name, so I just want whatever value I'll get.

Once you've settled on a separator, you're ready to choose the name of your new column. I'm going to name it store name and press OK. Upon refreshing the data will merge into a single column called store name dot one, which I'll quickly renamed a store name. At this point, we've appended our two queries together and merge the stores and store names column into a single field. append commands can be very useful for stacking datasets together that are in essence, the same data structure with different contents. You could stack older data from a backup with newer data for Long horizon report, where you combine a series of monthly reports together to create an annual report.

In conjunction with the merge columns command, stacking data together has never been faster or easier and Excel. Power Query is ability to connect datasets together does not stop it as simple data append. Our next lesson, we'll look at how easy it is to weave data together through a Power Query merge

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.