Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I am trying to do a full outer join in DAX (not in PQ)
I have two tables, T1 and T2, and am trying to make a merged table, M, as shown below.
I tried combinations of crossjoin and generate, but cannot find an appropriate solution. Is this possible?
Any suggestions welcome
Very odd error:
No common join columns detected. The join function 'NATURALLEFTOUTERJOIN' requires at-least one common join column.
new table = naturalleftouterjoin( selectcolumns(T1;"name";[name];"statusBefore";[statusBefore]); selectcolumns(T2;"name";[name];"statusToday";[statusToday]))
i'm not sure, but try this
Thanks for the suggestion.
I renamed name to name1, made a relationship between the two tables, and ran
Table = NATURALLEFTOUTERJOIN('Now','Before')
succssfully
@ahuhn but naturaleftouterjoin function gives only left join results right? if we need full outer join, is there any function?
I was not able to find a function, but found an approach -
Full outer join = Left Join + Right Anti Join.
For example -
I have two tables -
and this is the output required.
This can be achieved by -
FullOuterJoin = UNION(
var DepartmentLeftOuterJoinEmp = NATURALLEFTOUTERJOIN(Department,RELATEDTABLE(Emp))
return SELECTCOLUMNS(DepartmentLeftOuterJoinEmp,
"DepID", Department[DepID],
"EmpID", [Emp Id],
"Income", [Income],
"Name",[Name],
"DepName",[Dep Name]
),
var DepartmentUniqueIds = DISTINCT(Department[DepID])
return SELECTCOLUMNS(CALCULATETABLE(Emp, NOT(Emp[DepID] in DepartmentUniqueIds)),
"DepID", [DepID],
"EmpID", [Emp Id],
"Income", [Income],
"Name",[Name],
"DepName"," "
)
)the first table is left outer join and the other one is the right anti join, ie. those which is only present in the right table.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 35 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 75 | |
| 72 | |
| 38 | |
| 35 | |
| 25 |