If(cond, then, else)
If and nested If in Power BI
Qlik's If() maps directly to DAX IF and to Power Query's if ... then ... else. Long nested Ifs are cleaner as SWITCH(TRUE(), ...). Qlik's numeric booleans (-1/0) are the main difference.
Short answer: Use IF for one condition and SWITCH(TRUE(), cond1, r1, cond2, r2, else) for nested ones. In Power Query, write if ... then ... else if ....
What it does in Qlik
If(condition, then [, else]) returns then when the condition is true and else otherwise. If else is omitted, it returns NULL. A condition is true when it evaluates to any non-zero number; Qlik's True() is -1.
Qlik example
// script
If(Amount >= 10000, 'Large', If(Amount >= 1000, 'Medium', 'Small')) AS SizeBand
// chart
If(Sum(Sales) > Sum(Target), 'On track', 'Behind')Power BI equivalent
Calculated column or measure (DAX)
Size band =
SWITCH (
TRUE (),
Sales[Amount] >= 10000, "Large",
Sales[Amount] >= 1000, "Medium",
"Small"
)
Status = IF ( [Sales] > [Target], "On track", "Behind" )Power Query conditional column
= Table.AddColumn(Source, "SizeBand", each
if [Amount] >= 10000 then "Large"
else if [Amount] >= 1000 then "Medium"
else "Small", type text)Static bands like this are best done in Power Query (or in the source), where they compress well and are shared by all reports.
Gotchas and behaviour differences
- Qlik booleans are numbers:
Sum(Region = 'North')counts -1 per match. In DAX,TRUE()converts to 1, and in Power Query you needif ... then 1 else 0. - A blank amount: in Power Query
null >= 1000is null and theifraises an error, so test for null first. In DAX, BLANK compares as 0 and falls through to "Small". - If-based measures evaluated row by row inside large tables can be slow in both tools. Push static logic to columns.
Official documentation
- if - script and chart function (Qlik Help)
- IF function (DAX) (Microsoft Learn)
- SWITCH function (DAX) (Microsoft Learn)
- Add a conditional column (Power Query) (Microsoft Learn)
- SWITCH (dax.guide)
Related pages
Match(Region, 'North', 'South')
Match, MixMatch and WildMatch
Match, MixMatch and WildMatch test a value against a list and return its position (or 0). They differ in case sensitivity and wildcard support, and so do DAX and Power Query, in the opposite direction from what you might expect.
Partial / different approach
Pick(n, expr1, expr2, ...)
Pick (and Pick(Match()) measure switching)
Pick(n, ...) returns the n-th expression. It maps to SWITCH. The common Qlik measure-selector idiom Pick(Match(vMeasure, ...)) is better rebuilt with Power BI field parameters.
Direct equivalent
Null(), IsNull(), NullAsValue
NULL handling vs DAX BLANK and M null
Qlik NULL, DAX BLANK and Power Query null follow different arithmetic and comparison rules. This is one of the most common reasons migrated numbers do not reconcile.
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.