Forum Discussion

cz1750's avatar
cz1750
Frequent Visitor
8 years ago
Solved

Union all with multiple table joins

Hi I want to be able to do the following in powerbi without using sql (I.e by using the power bi data sources, modeling relationships and dax etc) Select col1,col2 from tableA Join tableB on ...
  • dearwatson's avatar
    8 years ago

    Yep this is basic Power Query

     

    there is two simple functions in the Query editor you need to understand to make this work

     

    Merge Queries (JOIN in SQL)

    Append Queries (UNION)

     

    to achieve this you would create a connnection to Table A and Table B then Merge A to Table B via the key cols and expand the cols in Table B that you need

     

    Then same method for Table C -> D

     

    Then Append results from Table A to Results from Table C

     

    I hope this makes sense.. the down side of using power query in this way is that it needs to bring in all 4 tables to make it work, hence using SQL to do the joins would be more efficient.

     

    Greg

  • dearwatson's avatar
    dearwatson
    8 years ago

    you can shift + select columns to merge in order (a little 1, 2, 3 etc will appear on the columns), select the equivalent columns in the same order to complete the merge