Forum Discussion
hksl
Helper I
9 years agoRetrieve result when tables related by combination key (two columns)
I am a beginner. Power Bi Desktop free version. Creating table visualization. I have following tables: Table1: C1 , C2, C3 1 2 a 1 3 g 2 2 c 2 3 h ...
BhaveshPatel
Super User
9 years agoYou can do the Left or Right Join in the Query Editor by merging the Two Queries and then expanding the new column.
Refer the screenshot for setting up the scenario.
MergeFinal Result
hksl
Helper I
9 years agoAlso, Table2 has 3,502,458 rowa.
But I also need 'distinct' in result.
To simplify task:
I need result as
1 2 a
1 3 g
2 2 c
2 3 h
which is the same as to execute SQL query
select distinct t1.C4
from Table2 t2
join Table1 t1 on t2.C11 = t1.C1 and t2.C22 = t1.C2
I don't see any options available for using 'distinct' in 'Merge ....'
Thank you
- BhaveshPatel9 years ago
Super User
To get a distinct rows, You can do GROUPBY before merging the column.
See the screenshot.