Skip to main content
Microsoft Idea

Power BI

Merged

Query Folding support for Table.AddIndexColumn()

Vote (3) Share
Pär Adeen's profile image

Pär Adeen on 03 Oct 2020 17:26:33

Currently a Table.AddIndexColumn() breaks the query folding towards a SQL database. This should be possible to implement. In it's simplest form this could be done with:
select
row_number() OVER(ORDER BY (select null) asc) as row
from Table

I understand there might be problems with eventual sort order proceeded by a Table.Sort(), but I'm sure the PQ team will figure out a solution for this. I see two alternatives: 1) incorporate the sort order in the Over(ORDER BY..., or 2) add an extra argument to the Table.AddIndexColumn() representing the sort order

Why is this needed: Creating data models with facts and dimensions out of flat files needs a key, and not using Data Flows, the data source is red many times and adding the key each time is not efficient