Professional Documents
Culture Documents
Tweet
Instapaper
Basically the solution is to create a query for each fact table and then
combine them using the Merge transformation in Power Query, which
basically is a Left or Inner Join. At the end of the session, I got the
question if it's possible to do a Full Outer Join instead, to which my initial
response was "Ehrmmm...". It's not possible through the user interface,
so I gave the advice to create a query that contains the cross join of the
dimensions you want to use, then left join all the fact tables against that
query and at the end filter out any rows where all the facts are empty.
This advice still stands for people who do not want to write a single line of
code in Power Query. However, when reading Chris Webbs excellent book
about Power Query and more specifically the chapter about M, I realized
there is a more elegant solution out there.
You start out just as usual, by creating two queries on top of the
these tables and then merging them together in the user interface.
After clicking OK, you get the following result:
The import part here is the M formula in the formula bar. There is actually
room for a final, optional parameter: JoinKind. If we simply add
JoinKind.FullOuter, we get our desired result.
Image reduced in size to fit your browser, click for original size
Of course, we still have to expand the NewColumn column to retrieve the
Category and the Value from the right input.
Â
Image reduced in size to fit your browser, click for original size
Renaming columns
Conclusion
Doing a Full Outer Join in Power Query is really straight forward and you
don't have to be an M guru to adapt the code.
Social Sitings
Tagged as join
power bi
power query
syndicated
Tweet
Instapaper