OpenBI Docs Buy

NATURALLEFTOUTERJOIN

Joins two tables on the columns they share, with every row of the first table included.

Group: Table manipulation. Compatible with DAX.

Syntax

NATURALLEFTOUTERJOIN ( <LeftTable>, <RightTable> )
ParameterTypeDescription
LeftTableTableThe first table; every one of its rows appears in the result.
RightTableTableThe second table, joined to the first on the columns they share.

Returns

Table. Every row of the left table with the matching rows of the right, or blanks where none matches.

Remarks

  • Shared columns are found as in NATURALINNERJOIN: the same name for tables made in the query, the same column of the model otherwise. They must have the same type.
  • A left row with several matches appears once for each.
  • Right rows without a partner are left out.
  • Text matches without regard to case, and a blank matches a blank.

Examples

Every order line, priced where possible

Stout has no price: its row stays, with a blank price.

EVALUATE
VAR Orders =
    DATATABLE (
        "Product", STRING, "Liters", INTEGER,
        { { "Pils", 120 }, { "IPA", 80 }, { "Stout", 45 }, { "Pils", 30 } }
    )
VAR PriceList =
    DATATABLE (
        "Product", STRING, "Price", DOUBLE,
        { { "Pils", 38 }, { "IPA", 64 }, { "Cider", 52 } }
    )
RETURN
    NATURALLEFTOUTERJOIN ( Orders, PriceList )
ORDER BY [Product], [Liters]
ProductLitersPrice
IPA8064
Pils3038
Pils12038
Stout45(blank)

Sales against targets

Shop B has no Pils target. Its IPA target has no sales and stays out.

EVALUATE
VAR Sold =
    DATATABLE (
        "Shop", STRING, "Product", STRING, "Liters", INTEGER,
        { { "A", "Pils", 120 }, { "B", "Pils", 10 }, { "A", "IPA", 30 } }
    )
VAR Targets =
    DATATABLE (
        "Shop", STRING, "Product", STRING, "Target", INTEGER,
        { { "A", "Pils", 100 }, { "A", "IPA", 50 }, { "B", "IPA", 20 } }
    )
RETURN
    NATURALLEFTOUTERJOIN ( Sold, Targets )
ORDER BY [Shop], [Product]
ShopProductLitersTarget
AIPA3050
APils120100
BPils10(blank)

NATURALINNERJOIN, GENERATEALL, CROSSJOIN, SELECTCOLUMNS.

Last updated · OpenBI Studio 0.3.74