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]). RangeSumtreats nulls as 0. DAX addition also treats BLANK as 0, but a cumulative measure returns BLANK on rows with no dates in context.
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.