cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
matdune56 Regular Visitor
Regular Visitor

Combining same field from 3 tables into single list

Hi

 

I hae queries which brings in company information for 3 different sources.


Each of the resulting tables has a Company Name Column

 

What I want to do is produce a single list of distinct companies from combining the 3 tables

 

e.g

 

table1- field company Name

Company1

Company2

 

table2- field company Name

Company3

Company4

 

table3- field company Name

Company5

Company6

 

Resulting table - field company Name

Company1

Company2

Company3

Company4

Company5

Company6

 

thanks

 

Mat

1 ACCEPTED SOLUTION

Accepted Solutions
v-jiascu-msft Super Contributor
Super Contributor

Re: Combining same field from 3 tables into single list

Hi Mat,

 

Maybe the Distinct function is also needed.

 

NewTable =
DISTINCT (
    UNION (
        VALUES ( Table1[Company Name] ),
        VALUES ( Table2[Company Name] ),
        VALUES ( Table3[Company Name] )
    )
)

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Combining same field from 3 tables into single list

Hi @matdune56

 

I think this would best done in the query editor but if you want to do it in DAX you can create a calculated table with this code:

 

 

NewTable =
UNION (
    VALUES ( Table1[Company Name] ),
    VALUES ( Table2[Company Name] ),
    VALUES ( Table3[Company Name] )
)

 

v-jiascu-msft Super Contributor
Super Contributor

Re: Combining same field from 3 tables into single list

Hi Mat,

 

Maybe the Distinct function is also needed.

 

NewTable =
DISTINCT (
    UNION (
        VALUES ( Table1[Company Name] ),
        VALUES ( Table2[Company Name] ),
        VALUES ( Table3[Company Name] )
    )
)

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

matdune56 Regular Visitor
Regular Visitor

Re: Combining same field from 3 tables into single list

thank you both for such a quick reply. Works perfectly.

 

Used a DAX function in the end

Highlighted
matdune56 Regular Visitor
Regular Visitor

Re: Combining same field from 3 tables into single list

sorry, one last question.

 

How would I add a field that denotes which table(s), the company name came from. Is it possible.

 

really apprecaite your help on this.

Super User
Super User

Re: Combining same field from 3 tables into single list

@matdune56

What if it comes from more than one table?

matdune56 Regular Visitor
Regular Visitor

Re: Combining same field from 3 tables into single list

Hi

 

the table that's been created has a single field, with all (distinct) company names from each of the 3 tables.

 

By looking at this new table, I'd want to user to know whether it had come from Table 1, Table 2, Table 3 or a combination of the 3 (the company name could be in more than one table).

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 361 members 3,342 guests
Please welcome our newest community members: