Forum Discussion

admincaleb007's avatar
admincaleb007
Frequent Visitor
4 years ago
Solved

Joining Tables with multiple columns

I'm wondering if there is a better way to be joining tables based on multiple columns.   Basically, I have 2 tables with computer names.  The computer names may be in "Column A" or "Column B" or "C...
  • VahidDM's avatar
    4 years ago

    Hi admincaleb007 

     

    Try this code to add a new table to your report:

     

    Table 3 = 
    VAR _A =
        UNION (
            VALUES ( 'Table 1'[ColA] ),
            VALUES ( 'Table 1'[ColB] ),
            VALUES ( 'Table 1'[ColC] )
        )
    VAR _AA =
        FILTER ( SUMMARIZE ( _A, [ColA] ), [ColA] <> "null" )
    VAR _B =
        UNION (
            VALUES ( 'Table 2'[ColA] ),
            VALUES ( 'Table 2'[ColB] ),
            VALUES ( 'Table 2'[ColC] )
        )
    VAR _BB =
        FILTER ( SUMMARIZE ( _B, [ColA] ), [ColA] <> "null" )
    RETURN
        SUMMARIZE ( UNION ( _AA, _BB ), [ColA] ) 

     

    Output:

     

     

    Download the sample file attached.

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
    Appreciate your Kudos!!
    LinkedIn: 
    www.linkedin.com/in/vahid-dm/