OpenBI Docs Buy

GENERATEALL

As GENERATE, keeping the rows that get none, with blanks.

Group: Table manipulation. Compatible with DAX.

Syntax

GENERATEALL ( <table1>, <table2> )
ParameterTypeDescription
table1TableThe rows to start from; every one of them appears in the result.
table2Table
evaluated for each row
The table worked out for each row of the first; it can use that row's columns.

Returns

Table. Each row of the first table paired with each row its second table gives; a row whose second table is empty appears once, with blanks on the right.

Remarks

  • It is GENERATE that never loses a row of the first table, as a left outer join never loses a row of the left table.
  • As in GENERATE, wrap table functions of the second argument in CALCULATETABLE when the row should filter them.
  • The two tables must not share a column name.

Examples

One row per crate, every shop listed

Storo fills no slot: it appears once, with a blank slot.

EVALUATE
VAR Shops =
    DATATABLE (
        "Shop", STRING, "Crates", INTEGER,
        { { "Frogner", 2 }, { "Storo", 0 }, { "Sagene", 1 } }
    )
VAR Slots = DATATABLE ( "Slot", INTEGER, { { 1 }, { 2 }, { 3 } } )
RETURN
    GENERATEALL ( Shops, FILTER ( Slots, [Slot] <= [Crates] ) )
ORDER BY [Shop], [Slot]
ShopCratesSlot
Frogner21
Frogner22
Sagene11
Storo0(blank)

A category with no product over half a million liters

No cider sold more than 500,000 liters, so the Cider row has a blank product.

EVALUATE
GENERATEALL (
    VALUES ( Products[Category] ),
    CALCULATETABLE (
        TOPN ( 1, FILTER ( VALUES ( Products[Product] ), [Liters sold] > 500000 ), [Liters sold] )
    )
)
ORDER BY Products[Category]
Products[Category]Products[Product]
BeerPils
Cider(blank)

GENERATE, NATURALLEFTOUTERJOIN, CROSSJOIN, CALCULATETABLE.

Last updated · OpenBI Studio 0.3.74