Forum Discussion
Expression.Error: There weren't enough elements in the enumeration to complete the operation
- 10 years ago
This error is thrown when pivoting columns with same name. Please check your column names in your data source. Also refer to a similar thread below:
Regards,
This error is thrown when pivoting columns with same name. Please check your column names in your data source. Also refer to a similar thread below:
Regards,
This soultion was helpful in that it gave met ideas on how to find ther error, but I found the error in my query was not related to pivoting but referring to a row at an index that did not exist. I'm including an explanation here in case it helps others:
I was adding a column that would store a list of values for the current record, but I had initially created an index that started at 1 instread of 0. Therefore, the last record in my query table would have an error value. Since this was outside of the preview range, the error was not apparent until I tried to load to the data model. Lesson learned: the first record in a table should be referred to with a zero, i.e. TableName{0}
#"Record Vlaues" = Table.AddColumn(#"Added Index", "NewColumn", each Record.FieldValues(#"Added Index"{[Index]}))