OpenBI Docs Buy

CURRENTGROUP

Inside GROUPBY, the rows of the group being computed.

Group: Table manipulation. Compatible with DAX.

Syntax

CURRENTGROUP ( )

It takes no parameters.

Returns

Table. The rows of the group GROUPBY is working on, with every column of its table.

Remarks

  • It exists only inside the expressions of GROUPBY; anywhere else it is an error.
  • Give it as the table of an X function, such as SUMX ( CURRENTGROUP (), [Liters] ), COUNTX, MAXX or AVERAGEX. DAX accepts nothing else around it, so stay with that form.
  • No context transition takes place: the group is a set of rows, not a filter.

Examples

Liters and lines per shop

EVALUATE
VAR Sold =
    DATATABLE (
        "Shop", STRING, "Product", STRING, "Liters", INTEGER,
        { { "A", "Pils", 10 }, { "A", "IPA", 5 }, { "B", "Pils", 7 }, { "B", "Pils", 3 } }
    )
RETURN
    GROUPBY (
        Sold,
        [Shop],
        "Liters", SUMX ( CURRENTGROUP (), [Liters] ),
        "Lines", COUNTX ( CURRENTGROUP (), [Liters] )
    )
ORDER BY [Shop]
ShopLitersLines
A152
B102

A group of groups

The inner GROUPBY totals each shop. The outer one has no grouping column, so all its rows form one group, and MAXX picks the largest total.

EVALUATE
VAR Sold =
    DATATABLE (
        "Shop", STRING, "Product", STRING, "Liters", INTEGER,
        { { "A", "Pils", 10 }, { "A", "IPA", 5 }, { "B", "Pils", 7 }, { "B", "Pils", 3 } }
    )
VAR PerShop =
    GROUPBY ( Sold, [Shop], "Liters", SUMX ( CURRENTGROUP (), [Liters] ) )
RETURN
    GROUPBY ( PerShop, "Largest shop", MAXX ( CURRENTGROUP (), [Liters] ) )
Largest shop
15

GROUPBY, SUMX, COUNTX, MAXX, SUMMARIZE.

Last updated · OpenBI Studio 0.3.74