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.
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
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)
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
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. UseMAX(Sales[OrderDate])if you need the latter.
Official documentation
- Set modifiers with dollar-sign expansions (Qlik Help)
- Variables in DAX (VAR) (Microsoft Learn)
- DATESINPERIOD function (DAX) (Microsoft Learn)
- ALLSELECTED (dax.guide)
Related pages
SET vSales = Sum(Sales); LET vToday = Today();
Variables (SET, LET and $-expansion)
Qlik variables hold expressions, values and settings, and are expanded as text. Power BI splits these roles: measures for reusable logic, Power Query parameters for load settings, what-if and field parameters for user input, calculation groups for logic applied to many measures, and VAR inside DAX.
Partial / different approach
Sum({<Field={value}>} Sales)
Set Analysis basics
How a basic Qlik set expression such as Sum({<Year={2024}>} Sales) maps to CALCULATE with filter arguments in DAX, and where the two engines behave differently.
Direct equivalent
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
AddMonths(startdate, n [, mode])
AddMonths
AddMonths shifts a date by n months. EDATE (DAX) and Date.AddMonths (M) do the same with mode 0 semantics. Mode 1 (end-relative) needs a few extra lines. DAX DATEADD is not the same function.
Direct equivalent
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.