SET vSales = Sum(Sales); LET vToday = Today();
Variables (SET, LET and $-expansion) in Power BI
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.
What it does in Qlik
SET assigns text as is, and LET evaluates the expression first. $(vName) pastes the text into a script or chart expression before it is evaluated, so variables can hold whole expressions, field names or parameters ($1). Variables are also set from input boxes and buttons.
Qlik example
SET vSales = Sum(Sales);
SET vSalesYear = Sum({<Year = {$1}>} Sales); // parameterised
LET vMaxYear = Year(Today());
// chart
$(vSales)
$(vSalesYear($(vMaxYear)))Power BI equivalent
Reusable logic as measures
Sales = SUM ( Orders[Amount] )
Sales current year =
VAR CurrentYear = YEAR ( TODAY () ) -- VAR = local, evaluated once
RETURN
CALCULATE ( [Sales], 'Date'[Year] = CurrentYear )User input (what-if parameter)
Growth = GENERATESERIES ( 0, 0.2, 0.01 ) -- column is [Value]
Growth Value = SELECTEDVALUE ( Growth[Value], 0 )
-- Modeling > New parameter > Numeric range creates the same table,
-- but renames the column to Growth[Growth] and writes the measure for you
Sales forecast = [Sales] * ( 1 + [Growth Value] )Load-time settings
Create a Power Query parameter (Home > Manage parameters), for example ServerName or StartYear, and use it in the queries. It can be changed in the service under the semantic model settings.
Gotchas and behaviour differences
- DAX has no text macro expansion. Logic that builds expressions from strings must be redesigned, usually with field parameters or calculation groups.
- Measures are evaluated in the filter context of each cell. A Qlik variable evaluated with
=once for the whole sheet behaves differently from a measure that is evaluated per row. - Power Query parameters are fixed per refresh, so report users can't change them. The exception is a dynamic M query parameter bound to a slicer, which works only with DirectQuery sources that support it.
Official documentation
- Let (script statement) (Qlik Help)
- Set (script statement) (Qlik Help)
- Use what-if parameters to visualize variables (Microsoft Learn)
- Let report readers use field parameters (Microsoft Learn)
- Calculation groups (Microsoft Learn)
- VAR keyword (DAX) (Microsoft Learn)
- Power Query parameters (Microsoft Learn)
Related pages
Sum({<Year={$(=Max(Year))}>} Sales)
Dollar-sign expansion in sets: $(=Max(Year))
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
Sum({StateName} Sales)
Alternate states (comparative analysis)
Alternate states give objects independent selection sets, for example comparing two groups of regions side by side. Power BI has one filter context per visual, plus disconnected tables and measures that apply them with TREATAS. There is no built-in "state" concept.
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
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.