SET ErrorMode = 0; ... IF ScriptError > 0 THEN ...

ErrorMode and ScriptError in Power BI

SET ErrorMode = 0 makes the Qlik script carry on after an error, and ScriptError lets you branch on it. Power Query handles errors at the value or step level. try ... otherwise replaces one failing expression, and Replace, Remove or Keep errors work on columns. A query with an unhandled error fails the whole refresh. There is no "continue the rest of the script" mode. To orchestrate around failures, use a Fabric pipeline.

Partial / different approach Power Query Fabric

Short answer: Wrap risky sources as try Source otherwise #table(...) to return an empty table with the same columns. Use Keep errors to inspect bad rows. Turn on refresh failure notifications in the service.

What it does in Qlik

  • ErrorMode 1 (the default) stops on errors and 0 ignores them.
  • ScriptError holds the code of the last error, ScriptErrorCount the count and ScriptErrorList the list.
  • A common pattern is trying to load a file, then loading a fallback if it's missing.

Qlik example

Qlik script
SET ErrorMode = 0;
Budget: LOAD * FROM [lib://Data/budget_2026.xlsx] (ooxml, embedded labels);
IF ScriptError > 0 THEN
  TRACE Budget file missing - loading empty table;
  Budget: LOAD * INLINE [Account, Amount];
END IF
SET ErrorMode = 1;

Power BI equivalent

Power Query

Power Query M
let
    Empty  = #table(type table [Account = text, Amount = number], {}),
    Budget = try Excel.Workbook(File.Contents("C:\Data\budget_2026.xlsx"), true){[Item = "Sheet1", Kind = "Sheet"]}[Data]
             otherwise Empty
in
    Budget

// value-level: bad numbers become null instead of errors
= Table.TransformColumns(Src, {{"Amount", each try Number.From(_) otherwise null, type nullable number}})

Gotchas and behaviour differences

  • Errors in individual cells don't fail the refresh by default. The values just become errors and load as blanks, with a warning in Desktop. Use Keep errors on a copy of the query to find them.
  • try ... otherwise around a whole source hides real outages too. Log it, for example by adding a "Loaded from fallback" column, so a missing file doesn't go unnoticed.

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.