Short answer: visual calculations have their own functions that work on the visual matrix: the rows and columns the visual shows. Moving along an axis: PREVIOUS, NEXT, FIRST, LAST, RANGE, RUNNINGSUM, MOVINGAVERAGE (shortcuts to OFFSET, INDEX and WINDOW). Moving between levels: COLLAPSE, COLLAPSEALL, EXPAND, EXPANDALL. Looking up a cell: LOOKUP, LOOKUPWITHTOTALS. Testing the level: ISATLEVEL. Most take an optional Axis (ROWS, COLUMNS, ...) and Reset.
They make the calculations people used to fight with in DAX (running totals, percent of parent, difference to previous) one short formula, on one visual.
Which functions move along an axis?
| Function | Does | Example | Shortcut to |
|---|---|---|---|
| PREVIOUS | the previous row's value | ProfitVSPrevious = [Profit] - PREVIOUS ( [Profit] ) | OFFSET ( -1 ) |
| NEXT | the next row's value | ProfitVSNext = [Profit] - NEXT ( [Profit] ) | OFFSET ( 1 ) |
| FIRST | the first row's value | ProfitVSFirst = [Profit] - FIRST ( [Profit] ) | INDEX ( 1 ) |
| LAST | the last row's value | ProfitVSLast = [Profit] - LAST ( [Profit] ) | INDEX ( -1 ) |
| RUNNINGSUM | a running total | RunningSumSales = RUNNINGSUM ( [Sales Amount] ) | WINDOW |
| MOVINGAVERAGE | a moving average over a window | MovingAverageSales = MOVINGAVERAGE ( [Sales Amount], 2 ) | WINDOW |
| RANGE | a slice of rows around the current one | AverageSales = AVERAGEX ( RANGE ( 1 ), [Sales Amount] ) | WINDOW |
RANGE ( step [, includeCurrent] [, axis] ... ) returns rows before (or after) the current one, for your own aggregation: SUMX ( RANGE ( 2 ), [Sales Amount] ) adds the current and the two previous rows.
Which functions move between levels?
| Function | Evaluated at | Example |
|---|---|---|
| COLLAPSE | one level up (the parent) | Percent of parent = DIVIDE ( [Sales Amount], COLLAPSE ( [Sales Amount], ROWS ) ) |
| COLLAPSEALL | the total of the axis | Percent of grand total = DIVIDE ( [Sales Amount], COLLAPSEALL ( [Sales Amount], ROWS ) ) |
| EXPAND | one level down (the children) | Average of children = EXPAND ( AVERAGE ( [Sales Amount] ), ROWS ) |
| EXPANDALL | the lowest level | Average of leaf level = EXPANDALL ( AVERAGE ( [Sales Amount] ), ROWS ) |
| ISATLEVEL | TRUE if a column is present at the current level | IsFiscalYearAtLevel = ISATLEVEL ( [Fiscal Year] ) |
In a matrix with Category and Product on rows, Percent of parent shows each product's share of its category and each category's share of the total.
How do LOOKUP and LOOKUPWITHTOTALS work?
They evaluate an expression at another cell of the visual matrix, named by its values:
-- sales of 2025 on every row (the current row's other filters still apply)
LookupSalesFor2025WithContext = LOOKUP ( SUM ( [Sales] ), [Year], "2025" )
-- the same, but unspecified columns are taken at total level
LookupSalesFor2025WithTotals = LOOKUPWITHTOTALS ( SUM ( [Sales] ), [Year], "2025" )
Index vs 2025 = DIVIDE ( [Sales], [LookupSalesFor2025WithContext] ) * 100LOOKUP keeps the current row's other columns (for a matrix with Year and Quarter, it looks up 2025 in the same quarter); LOOKUPWITHTOTALS uses totals for any column you do not name.
What do Axis and Reset change?
-- across columns instead of rows (a matrix with months on columns)
Running across months = RUNNINGSUM ( [Sales Amount], COLUMNS )
-- restart at each year in a Year, Month hierarchy on rows
Running per year = RUNNINGSUM ( [Sales Amount], HIGHESTPARENT )Axis values are ROWS, COLUMNS, ROWS COLUMNS, COLUMNS ROWS and versions with ROWPAGES and COLUMNPAGES for small multiples. Reset accepts NONE, HIGHESTPARENT, LOWESTPARENT, an integer or a field. Details in visual calculations.
What goes wrong?
- Using them in measures. These functions work only in visual calculations (
RANK,ROWNUMBER,OFFSET,INDEXandWINDOWwork in both). - Order. They follow the visual's sort on the axis; sort by the right field.
- Hidden levels.
COLLAPSEneeds a parent level on the axis; with one level it returns the total. - Fields not on the visual. A visual calculation can only use fields added to the visual (hide them if they should not show).
Where can you check this?
- Microsoft Learn: Visual calculations overview
- Microsoft Learn: LOOKUPWITHTOTALS function (DAX)
- Microsoft Learn: COLLAPSE function (DAX)
Where do you start?
In a matrix by category and product, add Percent of parent and Running sum as visual calculations. OFFSET and WINDOW are the model-level versions.