Forum Discussion
SanderTK
2 years agoAdvocate II
Adding index column in ADF Power Query
Hi everyone, At the moment I am trying to work around Spark M-code restrictions to create an index column within Data Factory's Power Query. While the option to add an index column is present in...
p45cal
2 years agoSolution Supplier
Starting with a table (Table1) with a single column headed stuff:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
AddedIndex = Table.FromColumns({Source[stuff],{1..Table.RowCount(Source)}},{"stuff","Index"})
in
AddedIndex
- p45cal2 years agoSolution Supplier
Further, if you have more than 1 column in your table you can try:
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], AddIndex=Table.FromColumns(Table.ToColumns(Source) & {{1..Table.RowCount(Source)}}, Table.ColumnNames(Source) & {"Index"}) in AddIndex- SanderTK2 years agoAdvocate II
The technique behind this works perfectly, however, ADF still gives an error about the dataset being dynamic in length which it cannot handle. I currently can't get the exact wording of the error because I get an internal server error when trying to load datasets into ADF power query.