OpenBI Docs Buy

ISATLEVEL

For a visual calculation's current row, whether that column is one of its level's columns.

A visual calculation works on the table behind a visual: a row for each group on the visual's axes and one for each of their totals. To try one in the OAX view, give a table that shape with DEFINE TABLE ... WITH VISUAL SHAPE: its axes, their groups, the TRUE/FALSE column that marks each group's totals and the order, and with DENSIFY a name for the column that marks rows the shape fills in. Then write the calculation as a COLUMN of that table, as Power BI's own queries do. The examples below are queries of that kind, small enough to check by hand.

Group: Window and visual calculations. Compatible with DAX.

Syntax

ISATLEVEL ( <column> )
ParameterTypeDescription
columnColumnA field on one of the visual's axes, such as [Quarter].

Returns

TRUE/FALSE. TRUE when the current row is grouped by that column, FALSE on the totals above it.

Remarks

  • On a quarter's row both ISATLEVEL ( [Year] ) and ISATLEVEL ( [Quarter] ) are TRUE; on a year's subtotal only the first; on the grand total neither.
  • It lets one calculation behave differently on the subtotals, for example IF ( ISATLEVEL ( [Quarter] ), PREVIOUS ( [Liters] ) ).
  • A field that is not on an axis of the visual, such as a value, is an error.
  • It plays the part ISINSCOPE plays in a measure.
  • It works only in a visual calculation; in a measure, a calculated column or a plain query it is an error.

Examples

Which level is this row?

DEFINE
    TABLE Visual =
        DATATABLE (
            "Year", INTEGER, "Quarter", INTEGER, "Liters", INTEGER, "All years", BOOLEAN, "All quarters", BOOLEAN,
            {
                { 2025, 1, 100, FALSE, FALSE }, { 2025, 2, 120, FALSE, FALSE }, { 2025, BLANK (), 220, FALSE, TRUE },
                { 2026, 1, 130, FALSE, FALSE }, { 2026, 2, 150, FALSE, FALSE }, { 2026, BLANK (), 280, FALSE, TRUE },
                { BLANK (), BLANK (), 500, TRUE, TRUE }
            }
        )
        WITH VISUAL SHAPE
            AXIS ROWS
                GROUP [Year] TOTAL [All years]
                GROUP [Quarter] TOTAL [All quarters]
                ORDER BY [Year], [Quarter]
            DENSIFY "Added"
    COLUMN Visual[At Year] = ISATLEVEL ( [Year] )
    COLUMN Visual[At Quarter] = ISATLEVEL ( [Quarter] )
    COLUMN Visual[Level] = IF ( ISATLEVEL ( [Quarter] ), "quarter", IF ( ISATLEVEL ( [Year] ), "year", "total" ) )
EVALUATE
SELECTCOLUMNS (
    Visual,
    "Year", [Year], "Quarter", [Quarter], "Liters", [Liters],
    "At Year", [At Year],
    "At Quarter", [At Quarter],
    "Level", [Level]
)
ORDER BY ISBLANK ( [Year] ), [Year], ISBLANK ( [Quarter] ), [Quarter]
YearQuarterLitersAt YearAt QuarterLevel
20251100TRUETRUEquarter
20252120TRUETRUEquarter
2025(blank)220TRUEFALSEyear
20261130TRUETRUEquarter
20262150TRUETRUEquarter
2026(blank)280TRUEFALSEyear
(blank)(blank)500FALSEFALSEtotal

Previous quarter on the quarters only

DEFINE
    TABLE Visual =
        DATATABLE (
            "Year", INTEGER, "Quarter", INTEGER, "Liters", INTEGER, "All years", BOOLEAN, "All quarters", BOOLEAN,
            {
                { 2025, 1, 100, FALSE, FALSE }, { 2025, 2, 120, FALSE, FALSE }, { 2025, BLANK (), 220, FALSE, TRUE },
                { 2026, 1, 130, FALSE, FALSE }, { 2026, 2, 150, FALSE, FALSE }, { 2026, BLANK (), 280, FALSE, TRUE },
                { BLANK (), BLANK (), 500, TRUE, TRUE }
            }
        )
        WITH VISUAL SHAPE
            AXIS ROWS
                GROUP [Year] TOTAL [All years]
                GROUP [Quarter] TOTAL [All quarters]
                ORDER BY [Year], [Quarter]
            DENSIFY "Added"
    COLUMN Visual[Previous quarter] = IF ( ISATLEVEL ( [Quarter] ), PREVIOUS ( [Liters] ) )
EVALUATE
SELECTCOLUMNS (
    Visual,
    "Year", [Year], "Quarter", [Quarter], "Liters", [Liters],
    "Previous quarter", [Previous quarter]
)
ORDER BY ISBLANK ( [Year] ), [Year], ISBLANK ( [Quarter] ), [Quarter]
YearQuarterLitersPrevious quarter
20251100(blank)
20252120100
2025(blank)220(blank)
20261130120
20262150130
2026(blank)280(blank)
(blank)(blank)500(blank)

ISINSCOPE, COLLAPSE, EXPAND, PREVIOUS.

Last updated · OpenBI Studio 0.3.74