RecNo(), RowNo()

RecNo and RowNo in Power BI

RecNo numbers input records and RowNo numbers output rows. In Power Query, add an index column before the filter step (RecNo) or after it (RowNo). The model has no row order, so keep the index as a column.

Partial / different approach Power Query

Short answer: Use Table.AddIndexColumn(Source, "RecNo", 1, 1). Its position among the steps decides whether it behaves like RecNo (before filters) or RowNo (after filters).

What it does in Qlik

RecNo() is the 1-based number of the record read from the current source, counted before WHERE. RowNo() is the position in the resulting table. It counts only kept rows and continues when rows are concatenated onto an existing table.

Qlik example

Qlik script
LOAD RecNo() AS SourceLine, RowNo() AS LoadedRow, *
FROM [lib://Data/lines.csv] (txt, utf8, embedded labels, delimiter is ',')
WHERE Amount > 0;

Power BI equivalent

Power Query

Power Query M
let
    WithRecNo = Table.AddIndexColumn(Source, "SourceLine", 1, 1, Int64.Type),
    Filtered  = Table.SelectRows(WithRecNo, each [Amount] > 0),
    WithRowNo = Table.AddIndexColumn(Filtered, "LoadedRow", 1, 1, Int64.Type)
in
    WithRowNo

Gotchas and behaviour differences

  • An index column stops query folding on most sources, so add it as late as possible, or compute ROW_NUMBER() in SQL.
  • DAX tables have no reliable physical order. For ranking or numbering in visuals, use RANKX, or the window function ROWNUMBER, with an explicit order.
  • Incremental refresh partitions number rows separately, so an index is not unique across partitions.

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.