RangeSum(Above(Sum(Sales), 0, RowNo()))
Running totals with RangeSum(Above(...)) in Power BI
The Qlik running-total idiom RangeSum(Above(Sum(Sales), 0, RowNo())) maps to a cumulative DAX measure, a WINDOW function, or the RUNNINGSUM visual calculation.
Short answer: The classic pattern is CALCULATE([Sales], FILTER(ALLSELECTED('Date'[Date]), 'Date'[Date] <= MAX('Date'[Date]))). In a visual, RUNNINGSUM([Sales]) is the closest match to Qlik's row-based logic.
What it does in Qlik
RangeSum adds its arguments and treats non-numeric values (including NULL) as 0. Combined with Above(expr, 0, RowNo()), it adds the current row and all rows above it in the column segment, which gives a running total in chart order. Qlik Sense also has an "Accumulation" modifier on measures that does the same.
Qlik example
RangeSum(Above(Sum(Sales), 0, RowNo())) // running total, restarts per segment
RangeSum(Above(TOTAL Sum(Sales), 0, RowNo(TOTAL))) // across the whole chartPower BI equivalent
Cumulative by date (model measure)
Sales running total =
CALCULATE (
[Sales],
FILTER ( ALLSELECTED ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
)WINDOW function (any sortable column)
Sales running total (window) =
CALCULATE (
[Sales],
WINDOW ( 1, ABS, 0, REL, ALLSELECTED ( 'Date'[YearMonth] ), ORDERBY ( 'Date'[YearMonth], ASC ) )
)Visual calculation
Running total = RUNNINGSUM ( [Sales] )Running total that resets each year
Sales YTD = TOTALYTD ( [Sales], 'Date'[Date] )Gotchas and behaviour differences
- Accumulating by a non-date column (for example products sorted by sales, for a Pareto chart) needs the
WINDOWform with anORDERBYon the measure, or a visual calculation. The date pattern does not apply. - Qlik's
RowNo()version restarts in each column segment, for example per year in a Year > Month table.WINDOWrestarts only if you addPARTITIONBY('Date'[Year]). - Put the column used in
ORDERBYon the visual's axis. If the axis shows another column from the same table instead, such as a month name sorted byYearMonthor a text key sorted by an index column, that column's filter stays on every row and the window shrinks to the current row. Fix both parts. UseSUMMARIZE(ALLSELECTED('Date'), 'Date'[YearMonth])as the relation, and remove the label column's filter withREMOVEFILTERS('Date'[MonthName])in the surroundingCALCULATE. Also don't callALLSELECTEDinside an iterator such asSUMX, where it returns only the rows being iterated. Compute it in a variable before the iterator. - The
FILTER(ALLSELECTED('Date'[Date]), ...)pattern relies on 'Date' being marked as a date table. Filtering its date column then also removes filters on other Date columns, such as a YearMonth on the axis. Without that, useALLSELECTED('Date')in theFILTER. RangeSumtreats nulls as 0. DAX addition also treats BLANK as 0, but a cumulative measure returns BLANK on rows with no dates in context.- Visual calculations have limits that matter when you migrate: you can't filter or sort a visual by them, change their aggregation, or reuse them in another visual. Data exports leave them out. They don't support dynamic format strings or Show items with no data. Slicers, custom visuals and paginated reports don't support them, and you can't pin a visual that uses them to a dashboard or publish it to the web. If any of these matter, use the model measure instead. (Microsoft's list)
Official documentation
- RangeSum - script and chart function (Qlik Help)
- Above - chart function (Qlik Help)
- WINDOW function (DAX) (Microsoft Learn)
- RUNNINGSUM function (DAX) (Microsoft Learn)
- TOTALYTD (dax.guide)
Related pages
Above(Sum(Sales))
Above, Below, Before and After
Above() reads the value from the previous row of the chart. Power BI offers three replacements: the OFFSET window function, the PREVIOUS visual calculation, and calendar-aware time intelligence. Each behaves differently when periods are missing.
Partial / different approach
RangeAvg(Above(Sum(Sales), 0, 3))
Moving averages with RangeAvg(Above(...))
RangeAvg(Above(Sum(Sales), 0, 3)) gives a 3-row moving average. In Power BI, use WINDOW with AVERAGEX, the MOVINGAVERAGE visual calculation, or a calendar-based DATESINPERIOD measure.
Partial / different approach
YearToDate(date [, yearoffset [, firstmonth [, todaydate]]])
YearToDate flags and YTD
Qlik's YearToDate() flag is relative to the reload date. DAX TOTALYTD is relative to the dates in the filter context. Pick the one that matches what users expect, or rebuild the flag as a calculated column.
Partial / different approach
Peek(field_name [, row_no [, table_name]])
Peek (running balances in the script)
Peek reads a field from a row already loaded into the output table. It is used for running balances and for reading values into variables. Power Query has no row-by-row state, so use grouped list logic, a SQL window function upstream, or a DAX measure.
Partial / different approach
Spotted an error or a better pattern? QlikToDax is maintained by a working BI consultant; corrections are welcome via the About page. Last reviewed 2026-10-25.