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> )
| Parameter | Type | Description |
|---|---|---|
column | Column | A 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] )andISATLEVEL ( [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
ISINSCOPEplays 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]
| Year | Quarter | Liters | At Year | At Quarter | Level |
|---|---|---|---|---|---|
| 2025 | 1 | 100 | TRUE | TRUE | quarter |
| 2025 | 2 | 120 | TRUE | TRUE | quarter |
| 2025 | (blank) | 220 | TRUE | FALSE | year |
| 2026 | 1 | 130 | TRUE | TRUE | quarter |
| 2026 | 2 | 150 | TRUE | TRUE | quarter |
| 2026 | (blank) | 280 | TRUE | FALSE | year |
| (blank) | (blank) | 500 | FALSE | FALSE | total |
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]
| Year | Quarter | Liters | Previous quarter |
|---|---|---|---|
| 2025 | 1 | 100 | (blank) |
| 2025 | 2 | 120 | 100 |
| 2025 | (blank) | 220 | (blank) |
| 2026 | 1 | 130 | 120 |
| 2026 | 2 | 150 | 130 |
| 2026 | (blank) | 280 | (blank) |
| (blank) | (blank) | 500 | (blank) |