SUB LoadDim(vName) ... END SUB; CALL LoadDim('Customer');

SUB, CALL and $(Include) in Power BI

A SUB in Qlik maps to a custom function in Power Query, (param) => ..., invoked like any function. $(Include=...), which shares script files across apps, has no direct equivalent in Power BI Desktop. The closest options are shared dataflows, which centralise the transformation itself, Power Query templates (.pqt), or copy-pasting functions, which is honest but manual.

Partial / different approach Power Query Fabric Dataflows

Short answer: Convert each SUB into a function query (LoadDim = (name as text) as table => ...). For code reused across reports, move the logic into a dataflow or Lakehouse that the reports connect to, rather than sharing code.

What it does in Qlik

  • SUB name(params) ... END SUB defines a reusable block, and CALL name(args) runs it.
  • $(Include=file.qvs) and $(Must_Include=...) pull script text in from a file, often for shared connection strings, calendars or variable definitions.

Qlik example

Qlik script
$(Must_Include=lib://Shared/connections.qvs);

SUB LoadDim(vName)
  [$(vName)]: LOAD * FROM [lib://QVD/Dim_$(vName).qvd] (qvd);
END SUB
CALL LoadDim('Customer');
CALL LoadDim('Product');

Power BI equivalent

Custom function

Power Query M
// query "LoadDim"
(name as text) as table =>
    let
        Source = Lakehouse.Contents(null){[workspaceId = WsId]}[Data]{[lakehouseId = LhId]}[Data],
        T      = Source{[Id = "dim_" & Text.Lower(name), ItemKind = "Table"]}[Data]
    in
        T

// query "Customer"
= LoadDim("Customer")

The Lakehouse navigation above is illustrative. Generate the real Source step with Get data, then turn the table name into the parameter.

Shared connection settings

Use Parameters (Manage parameters) for server names and paths in place of include files with connection strings. Deployment pipelines can set them per stage.

Gotchas and behaviour differences

  • No 1:1 for Include. There's no file include in Power Query. When the same SUB appears in 20 Qlik apps, the right Power BI design is usually one shared semantic model or dataflow, not 20 copies of a function.
  • Dynamic data sources built inside functions, such as concatenated file paths, can block scheduled refresh in the service. Keep the base path static or parameterised.

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.