Alt(Sales, 0)
Alt and Coalesce in Power BI
Qlik Coalesce() and DAX COALESCE() both return the first argument that isn't NULL or BLANK. Alt() is different: it returns the first argument that has a valid number representation, so Alt('abc', 0) returns 0. DAX has no single function that skips text that way. Power Query uses the ?? operator.
Short answer: Translate Alt(x, 0) on numbers to COALESCE([x], 0) in DAX or [x] ?? 0 in M. Before you add a fallback to a measure, check whether showing 0 is what you want, because it makes empty rows appear.
What it does in Qlik
Alt(e1, e2, ..., else)returns the first argument with a valid number representation, and the last argument if none has one.Coalesce(e1, e2, ...)returns the first non-NULL argument, whether it's text or a number. It's in Qlik Cloud and newer Qlik Sense client-managed releases.- Both work in the script and in charts.
Qlik example
Alt(Discount, 0) AS Discount // NULL or text -> 0
Alt(Date#(D, 'YYYY-MM-DD'), Date#(D, 'DD/MM/YYYY')) // first format that parses
Coalesce(Nickname, FirstName, 'Unknown') AS DisplayNamePower BI equivalent
DAX
Sales (0 when empty) = COALESCE ( [Sales], 0 )
Display name =
COALESCE ( Customer[Nickname], Customer[FirstName], "Unknown" )Power Query
// null-coalescing operator
= Table.AddColumn(Source, "Discount0", each [Discount] ?? 0, type number)
// Alt(Date#(...), Date#(...)) style: try one format, then another
= Table.AddColumn(Source, "D", each
try Date.FromText([D], [Format = "yyyy-MM-dd"])
otherwise try Date.FromText([D], [Format = "dd/MM/yyyy"])
otherwise null, type date)try ... otherwise is the real Power Query match for Alt's "first one that parses as a number" behaviour.
Gotchas and behaviour differences
- No 1:1 for Alt on text.
COALESCEreturns"abc"where Alt would skip it. If a column mixes numbers and text, fix the type in Power Query withtry Number.From(...) otherwise null. COALESCE([Sales], 0)in a matrix makes every row in the cross join show 0, for example every product times every month, because the measure is never blank. Qlik hides those combinations when they have no data. Consider applying the fallback only inside an existing context, as inIF(NOT ISEMPTY(Sales), COALESCE(...)).- DAX
ISBLANKon an empty string returns FALSE.COALESCEtreats "" as a value, as Qlik Coalesce does. See null handling.
Official documentation
- alt - script and chart function (Qlik Help)
- Coalesce - script and chart function (Qlik Help)
- COALESCE function (DAX) (Microsoft Learn)
- Power Query M operators (??) (Microsoft Learn)
- Error handling in Power Query (try otherwise) (Microsoft Learn)
Related pages
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
If(cond, then, else)
If and nested If
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.
Direct equivalent
Date(Date#(text, 'YYYYMMDD'), 'DD-MM-YYYY')
Date#() parsing and Date() formatting
Date#() interprets text as a date and Date() formats a number as a date, keeping it a dual. In Power BI, parse in Power Query with Date.FromText and set the display format on the column. DAX FORMAT() turns a date into text.
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.