LOAD ..., Sum(x) RESIDENT t GROUP BY ...

Group By in the load script in Power BI

GROUP BY in a Qlik load pre-aggregates a table. Power Query's Group by (Table.Group) is the direct equivalent. In Power BI you often don't need it at all, because measures aggregate at query time.

Direct equivalent Power Query DAX

Short answer: Use Transform > Group by, or Table.Group(T, {"Customer"}, {{"Total", each List.Sum([Amount]), type number}}). Before porting, ask whether a measure would do.

What it does in Qlik

A LOAD with GROUP BY aggregates rows. Every non-aggregated field must be in the group-by list. It is typically a resident load that creates a summary or snapshot table.

Qlik example

Qlik script
CustomerSummary:
LOAD CustomerID, Sum(Amount) AS TotalAmount, Count(OrderID) AS Orders, Max(OrderDate) AS LastOrder
RESIDENT Orders
GROUP BY CustomerID;

Power BI equivalent

Power Query

Power Query M
= Table.Group(Orders, {"CustomerID"}, {
    {"TotalAmount", each List.Sum([Amount]), type nullable number},
    {"Orders", each Table.RowCount(_), Int64.Type},
    {"LastOrder", each List.Max([OrderDate]), type nullable date}
  })

Or just measures

DAX
Total amount = SUM ( Orders[Amount] )
Orders = COUNTROWS ( Orders )
Last order = MAX ( Orders[OrderDate] )

Gotchas and behaviour differences

  • Count(OrderID) in Qlik counts non-null values. Table.RowCount(_) counts rows. Use List.NonNullCount([OrderID]) for the exact equivalent.
  • Group by folds to SQL on most relational sources. On files, it runs in the mashup engine.
  • A pre-aggregated table loses detail. Keep the detail table too if users need to drill down.

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.