@akeko Full Outer Join.pbix (97.1 KB)
Your result is incorrect, OUTER JOIN doesn’t work like that for AG there will be 4 rows 2 * 2.
Table 2 =
VAR FirstTable =
SELECTCOLUMNS (
Table1,
"Company", Table1[Company] & "",
"Outlet_", Table1[Outlet] & "",
"Group_", Table1[Group] & "",
"Date_", Table1[Date] & "",
"Price_", Table1[Price] & ""
)
VAR SecondTable =
SELECTCOLUMNS (
Table2,
"Company", Table2[Company] & "",
"Company2", Table2[Company] & "",
"Outlet", Table2[Outlet] & "",
"Group", Table2[Group] & "",
"Date", Table2[Date] & "",
"Price", Table2[Price] & ""
)
VAR ExistsInSecondNotInFirst =
SELECTCOLUMNS (
CALCULATETABLE (
Table2,
EXCEPT ( VALUES ( Table2[Company] ), VALUES ( Table1[Company] ) )
),
"Company2", Table2[Company],
"Outlet", Table2[Outlet],
"Group", Table2[Group],
"Date", Table2[Date],
"Price", Table2[Price]
)
VAR LeftJoin =
NATURALLEFTOUTERJOIN ( FirstTable, SecondTable )
VAR NewCols =
ADDCOLUMNS (
ExistsInSecondNotInFirst,
"Company", "",
"Outlet_", "",
"Group_", "",
"Date_", "",
"Price_", ""
)
VAR FinalTable =
SELECTCOLUMNS (
NewCols,
"Company", [Company],
"Outlet_", [Outlet_],
"Group_", [Group_],
"Date_", [Date_],
"Price_", [Price_],
"Company2", [Company2],
"Outlet", [Outlet],
"Group", [Group],
"Date", [Date],
"Price", [Price]
)
VAR Result =
UNION ( LeftJoin, FinalTable )
RETURN
Result