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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Madxfr
Frequent Visitor

Create one table from 2 tables (inner join)

Hello,

 

I have 2 tables with:

 

Table1

id  Col1 Col2 Col3

1   A      BB      2

1   A      CC      4

1   B      AA      5

2   A      CC      10

2   B      AA      6

2   C      CC      8

2   A      CC      10

3   D      BA      6

3   H      FC      8

 

Table2

id  Col1 Col2 Col3

1   XX4     1      2

1   AA5     5     4

1   BB1      8     5

3   AC1      9    10

3   BD2     10    6

3   C      CC      8

 

Result expected:

Table_Res

id  Col3

1   2

1   4

1   5

3   6

3   8

 

I need to create a table with column id and Col3 from Table1 but only where id included in table2.

A kinf of : select id,col3 from table1 inner join table2 on table1.id=table2.id

 

Thanks for your help.

 

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @Madxfr ,

You can use values function to extract table 2 id and use 'in' operator to compare with these fields:

NEW Table =
SELECTCOLUMNS (
    FILTER ( Table1, [id] IN VALUES ( Table2[id] ) ),
    "id", [id],
    "Col3", [Col3]
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @Madxfr ,

You can use values function to extract table 2 id and use 'in' operator to compare with these fields:

NEW Table =
SELECTCOLUMNS (
    FILTER ( Table1, [id] IN VALUES ( Table2[id] ) ),
    "id", [id],
    "Col3", [Col3]
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thanks, it's faster than merge table and so simple when you have the solution 😉

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.