Sum({<Year={$(=Max(Year))}>} Sales)

Dollar-sign expansion in sets: $(=Max(Year)) in Power BI

Dollar-sign expansions such as $(=Max(Year)) put a calculated value into a set expression. In DAX you use a variable, but it is evaluated per cell, not once per chart.

Partial / different approach DAX

Short answer: Use VAR MaxYear = CALCULATE(MAX('Date'[Year]), ALLSELECTED()), then CALCULATE([Sales], 'Date'[Year] = MaxYear). Use ALLSELECTED to get Qlik's "once per chart" value. Without it, each row computes its own max.

What it does in Qlik

$(=expression) is evaluated once, before the chart is calculated, and its text result is pasted into the set expression. Typical uses are "latest year", "previous year" and "rolling 12 months up to the latest date".

Qlik example

Qlik chart expressions
Sum({<Year={$(=Max(Year))}>} Sales)
Sum({<Year={$(=Max(Year)-1)}>} Sales)
Sum({<Date={">=$(=AddMonths(Max(Date),-12))<=$(=Max(Date))"}, Year=, Month=>} Sales)

Power BI equivalent

Latest selected year (once per visual, like Qlik)

DAX
Sales latest year =
VAR MaxYear = CALCULATE ( MAX ( 'Date'[Year] ), ALLSELECTED () )
RETURN
    CALCULATE ( [Sales], 'Date'[Year] = MaxYear )

Rolling 12 months to the last date in context

DAX
Sales R12M =
CALCULATE (
    [Sales],
    DATESINPERIOD ( 'Date'[Date], MAX ( 'Date'[Date] ), -12, MONTH )
)

Filtering the date column also clears Year and Month filters on a marked date table. That is what the Qlik example does explicitly with Year=, Month=.

Gotchas and behaviour differences

  • Without ALLSELECTED, MAX('Date'[Year]) is evaluated in each cell. In a visual by Year, every row then compares the year to itself. Sometimes that is right, but it is a different number from Qlik.
  • DATESINPERIOD(..., -12, MONTH) starts the day after the same date one year earlier. The Qlik example with >= includes that day, so the two differ by one day.
  • Qlik dollar expansion is text substitution and can produce invalid syntax silently. DAX variables are typed and are validated when you save the measure.
  • MAX('Date'[Date]) returns the last date in the calendar, not the last date with sales. Use MAX(Sales[OrderDate]) if you need the latter.

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.