Today DS43 covered a lot of content on PowerBI and PowerQuery. We tackled the first 4 weeks of the preppin’ data challenges in PowerQuery, learning how the steps differ to Tableau Prep. One of the steps that seemed to be quite different from Tableau Prep was merging.
Merging columns
In PowerQuery, we can perform a merge on columns using either the ‘Transform’ or ‘Add Column’ tab. If we want to merge the columns without preserving the originals, we can use the ‘Transform’ tab. Alternatively, if we want to keep the original columns and create a new merged field, we can use the ‘Add Column’ tab.
Merging tables
When merging queries (i.e tables), we can select the queries we want to merge from the left-hand pane with ctrl + click, selecting combine (on the the right of the home tab), and either 'merge queries' if we do not want to preserve the original queries or 'merge queries as new' if we do. This will bring up a window from which we can select the columns we want to merge on. This merged column will initially contain all the values from the query we merged with. To only show the desired field, filter the column to the one needed. See the pictures below for an example where we used book data to merge the tables Author and Book by BookID.