Forum Discussion

amani1980's avatar
amani1980
Frequent Visitor
1 year ago
Solved

Combine two columns...(Not Merge)

Hi,

 

I'm looking to combine data from two columns from different tables. Not merge. Each table has two columns country and event and I want to create a new table that contains both tables as shown below. I know I can do this by Append Query as New in Power Query. However, this slows the model a lot. I have shown only two columns of each tables whereas in reality there are more than 30-40 columns and 1000s of rows in each table. So append queries and delete the remaining columns is very tedious and slwos the data refresh. Is there any way I can pull only these two columns from the two tables directly and create a combined new table witout losing the relation between Country and Ticket? Model here....

 

 

Thanks in advance,

-AM

 

  • hi amani1980 ,

     

    try to write a calculated table like:

    table3=

    DISTINCT(

    UNION(

        SUMMARIZE(

            table1, 

            table1[country],

            table1[ticket]

        ),

        SUMMARIZE(

            table2, 

            table2[country],

            table2[ticket]

        )

    )

    )

3 Replies

  • hi amani1980 ,

     

    try to write a calculated table like:

    table3=

    DISTINCT(

    UNION(

        SUMMARIZE(

            table1, 

            table1[country],

            table1[ticket]

        ),

        SUMMARIZE(

            table2, 

            table2[country],

            table2[ticket]

        )

    )

    )

  • Irwan's avatar
    Irwan
    Icon for Super User rankSuper User

    hello amani1980 

     

    i might be misunderstood but perhaps what you are looking for is UNION().

     

    here is a simple example:
    - Table 1

    - Table 2

    - New Table with UNION() DAX

     

    Hope this will help.

    Thank you.

  • amani1980's avatar
    amani1980
    Frequent Visitor

    Hi,

     

    Thanks for replying!

     

    I want to do something similar not quite the same - I don't want to combine all columns from both tables. Just the Country and Ticket columns from the 30-40 colunms there is in each one of the tables. I showed just the two columns in the screenshot for sake of simplicity.