Power Query: Selective Staffing Part 6
1 December 2021
Welcome to our Power Query blog. This week I look at another method to solve my second inclusion example.
In Power Query: Selective Staffing Part 3, I had a table of quote data for each of my salespeople, and a list of salespeople that I wished to view quote details for:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/261/image1.png/e774d10cbbb9450fc45efbe51abdf434.jpg)
I used M List() functionality to achieve the result:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/261/image2.png/f32e5a15e2cf9c3e4d2d058458ce054d.jpg)
There is often more than one method to achieve the same results, and this time, I will look at another approach I could have used for this example.
Instead of using list functionality, I could join the tables. To show how this would work, I start again with a copy of the original data. In this example, the Excel Tables are called Staff_Quotes_Join and Quote_Selection_Join.
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/261/image3.png/f1140ff857fc3b6f5f97a6a24f4a6fc7.jpg)
I import both Tables using ‘From Table/Range’ in the ‘Get & Transform’ section of the Data tab. This time, I leave Quote_Selection_Join as a table:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/261/image4.png/72aa864d2854c6fefb1083fba0ab5792.jpg)
Starting from Staff_Quotes_Join, I can choose to ‘Merge Queries’ from the Home tab.
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/261/image5.png/36776d1da4d05b45bb5a5d09375f407c.jpg)
In the dialog, I choose Quote_Selection_Join:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/261/image6.png/23912d3b1671861e02bebcd5183f1607.jpg)
If I choose to link Salesperson to Include, I could use a ‘Left Outer’ join to select all the matching rows.
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/261/image7.png/6f49c288a0d88a66b427eaf4ece923d6.jpg)
This matches four rows on the first table, but it would still leave me with more work to do as I would still have all the rows from the first table:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/261/image8.png/b9ee28d90e6b5bc92ea4aeafdad51628.jpg)
I could start from Quote_Selection_Join and perform a ‘Left Outer’ join from there, but that will not help me when I come to expand this example later. Alternatively, I could use a different type of join – an Inner Join:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/261/image9.png/0485ccbc83bdeec1d741bad442a1ea5f.jpg)
I use the Inner Join:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/261/image10.png/daf8c4f0259ce428269c0d3d4badd32b.jpg)
Although it sounds similar, the results are not the same:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/261/image11.png/22c6daeb82d7d69ac88f878227e04b28.jpg)
I don’t need to expand the new column, I can simply delete it, and I have all the data I need.
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/261/image12.png/a1537847463e660a31158c8032525438.jpg)
Next time I will look at how I can expand this to allow me to consider inclusion and exclusion in the same example.
Come back next time for more ways to use Power Query!