OpenBI Docs Buy

PARTITIONBY

In a window function, the columns that split its table into partitions.

Group: Window and visual calculations. Compatible with DAX.

Syntax

PARTITIONBY ( <partitionBy_columnName> [, <partitionBy_columnName>] … )
ParameterTypeDescription
partitionBy_columnNameColumn
repeatable
A column of the relation; rows with the same values in these columns form one partition.

Returns

None. It gives no value of its own: it tells the window function around it how to split the rows.

Remarks

  • The window function works inside the current row's partition: OFFSET ( -1, ... ) never reaches into another product's months, RANK starts at 1 in each category.
  • The columns must be columns of the relation, not new columns a table function added.
  • It goes only inside a window function; anywhere else it is an error.
  • In a visual calculation the reset parameter usually does this job by the visual's own levels; the two can't be given together.

Examples

Rank within each category

EVALUATE
ADDCOLUMNS (
    VALUES ( Products[Product] ),
    "Category", CALCULATE ( SELECTEDVALUE ( Products[Category] ) ),
    "Rank in category",
        RANK (
            DENSE,
            ALL ( Products[Product], Products[Category] ),
            ORDERBY ( [Liters sold], DESC ),
            PARTITIONBY ( Products[Category] )
        )
)
ORDER BY [Category], [Rank in category]
Products[Product]CategoryRank in category
PilsBeer1
IPABeer2
LettølBeer3
CiderCider1

The month before, in each shop

EVALUATE
VAR Pils =
    FILTER (
        Sales,
        Sales[Product] = "Pils"
            && ( Sales[Shop] = "Shop Kampen" || Sales[Shop] = "Shop Sagene" )
            && YEAR ( Sales[Month] ) = 2026 && MONTH ( Sales[Month] ) <= 3
    )
RETURN
    ADDCOLUMNS (
        Pils,
        "Month before",
            MAXX (
                OFFSET ( -1, Pils, ORDERBY ( Sales[Month] ), PARTITIONBY ( Sales[Shop] ) ),
                Sales[Liters]
            )
    )
ORDER BY Sales[Shop], Sales[Month]
Sales[Month]Sales[Shop]Sales[Product]Sales[Liters]Month before
2026-01-01Shop KampenPils278(blank)
2026-02-01Shop KampenPils326278
2026-03-01Shop KampenPils278326
2026-01-01Shop SagenePils260(blank)
2026-02-01Shop SagenePils275260
2026-03-01Shop SagenePils262275

ORDERBY, MATCHBY, RANK, OFFSET.

Last updated · OpenBI Studio 0.3.74