RangeMax(Sales, Target, 0)

RangeMax, RangeMin, RangeCount in Power BI

The Range functions aggregate a list of values in one row, not a column. DAX MAX and MIN accept exactly two scalar arguments. For three or more, iterate over a table constructor. Power Query's List.Max, List.Min and List.Count take any list. When Range functions wrap Above(), see the window-function pages instead.

Partial / different approach DAX Power Query

Short answer: Use MAXX({[A], [B], [C]}, [Value]), which skips blanks like RangeMax ignores NULL. Two-argument MAX([Sales], [Target]) is fine only when neither value can be blank. In M, use List.Max({[A], [B], [C]}). To count numeric non-null values, use List.Count(List.RemoveNulls(...)).

What it does in Qlik

  • RangeMax(e1, e2, ...) returns the highest numeric value among the arguments and ignores NULL and text.
  • RangeMin returns the lowest.
  • RangeCount counts the arguments that are numbers or text, skipping NULLs.
  • With an inter-record argument such as Above(Sum(Sales), 0, 3), the range is made of several chart rows.

Qlik example

Qlik script and chart
RangeMax(Q1, Q2, Q3, Q4) AS BestQuarter
RangeMin(Sum(Sales), Sum(Target))
RangeMax(Above(Sum(Sales), 0, 12))     // max of the last 12 rows

Power BI equivalent

DAX

DAX
Lower of sales and target = MINX ( { [Sales], [Target] }, [Value] )   -- skips a blank target

Best quarter =
MAXX ( { Plan[Q1], Plan[Q2], Plan[Q3], Plan[Q4] }, [Value] )

Max of last 12 months (visual calc) =
MAXX ( WINDOW ( -11, REL, 0, REL, ROWS ), [Sum of Sales] )

Power Query

Power Query M
= Table.AddColumn(Source, "BestQuarter",
    each List.Max({[Q1], [Q2], [Q3], [Q4]}), type number)

= Table.AddColumn(Source, "FilledQuarters",
    each List.Count(List.RemoveNulls({[Q1], [Q2], [Q3], [Q4]})), Int64.Type)

Gotchas and behaviour differences

  • Two-argument MAX(a, b) and MIN(a, b) treat BLANK as a real value: MAX(BLANK(), -5) returns BLANK, and MIN([Sales], BLANK()) returns BLANK for any positive sales. RangeMax and RangeMin ignore the NULL and return the other value. MAXX and MINX over a table constructor skip blanks, like Qlik.
  • Columns named Q1 to Q4 usually mean the data should be unpivoted. After CrossTable/Unpivot, a plain MAX on one column works.

Official documentation

Related pages

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.