Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ericOnline
Post Patron
Post Patron

Get list of distinct values from multiple tables?

Hello,

 

I have 4 tables of data, each with an "EMAIL" column. I'd like to create a new table of the unique Email addresses found across all tables. Then use this EMAIL_TABLE as a JOIN table. 

 

How is this done in PowerQuery?

 

Example:

Table 1:

EMAIL1TBL1_VAL0TBL1_VAL1

TBL1_VAL2

bob@bob.comAB

C

Table 2:

EMAIL2TBL2_VAL0TBL2_VAL1

TBL2_VAL2

sally@sally.comXY

Z

Table 3:

EMAIL3TBL1_VAL0TBL1_VAL1

TBL1_VAL2

bill@bill.com12

3

Table 4:

EMAIL4TBL1_VAL0TBL1_VAL1

TBL1_VAL2

bob@bob.comZX

Y

 

EMAIL_TABLE:

EMAIL_DISTINCT
bob@bob.com
sally@sally.com
bill@bill.com
1 ACCEPTED SOLUTION

In PowerQuery, you could do something like this.

 

let
Source = List.Union({#"Table1"[Email1],#"Table2"[Email2],#"Table3"[Email3],#"Table4"[Email4]}),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
#"Converted to Table"

View solution in original post

3 REPLIES 3
ericOnline
Post Patron
Post Patron

Thank you for the details. Yes, I want to do this in Power Query. What would that look like?

In PowerQuery, you could do something like this.

 

let
Source = List.Union({#"Table1"[Email1],#"Table2"[Email2],#"Table3"[Email3],#"Table4"[Email4]}),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
#"Converted to Table"

You would be able to use something like this.

 

Table =
DISTINCT (
UNION (
SELECTCOLUMNS (
'Table1',
"Email", [Email1]
),
SELECTCOLUMNS (
'Table2',
"Email", [Email2]
),
SELECTCOLUMNS (
'Table3',
"Email", [Email3]
),
SELECTCOLUMNS (
'Table4',
"Email", [Email4]
)
)
)

 

However, this sort of thing is better done in Power Query.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors