Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello,
I am trying to add a new row to my existing table with some dummy data using insertrows function. But its invocation does not add the values to the newly added row. It gives error: "There weren't enough elements in the enumeration to complete the operation".
The existing table say I have "Table1" with following columns:
DateValue | Unique Dates | A.1 | B.1 | C.1 | D.1 | E.1 | F.1 | G.1 | H.1 | I.1 | J.1 | K.1 | L.1 | M.1| Index | Testline Dates
Now I am using this call in my function in the advanced query editor:
Table.InsertRows(#"Table1", offset, {[DateValue=nDate, Unique Dates=nDate, A.1="0",B.1="0", C.1="0", D.1="0", E.1="0", F.1="0", G.1="0", H.1="0", I.1="0", J.1="0", K.1="0", L.1="0", M.1="0", Index=nIndex, Testline Dates=TestlineDate]})
The resultant row added but with error for every column. Any ideas for this sort of error?
Expression.Error: There weren't enough elements in the enumeration to complete the operation.
Details:
[List]
Solved! Go to Solution.
Some proper sample data would have helped. However, you've probably got the offset wrong
Some proper sample data would have helped. However, you've probably got the offset wrong
I figured it out to be the issue with offset only. It is starting with zero and I was considering it starting with one.
Thanks for your quick help.
Here is my function for inserting rows:
(NDaysToExtend as number, offset as number, LastBurndownDate as date, LastIndex as number, TestlineDate as date) =>
let
CurrentLoop = 0,
nDate = LastBurndownDate,
nIndex = LastIndex,
NewRow =
if CurrentLoop < NDaysToExtend
then
{
CurrentLoop = CurrentLoop + 1,
nDate = Date.AddDays(nDate, 1),
nIndex = nIndex + 1,
Table.InsertRows(#"Table1", offset, {[DateValue=nDate, Unique Dates=nDate, A.1="0", B.1="0", C.1="0", D.1="0", E.1="0", F.1="0", G.1="0", H.1="0", I.1="0", J.1="0", K.1="0", L.1="0", M.1="0", Index=nIndex, Testline Dates=TestlineDate]}),
//@InsertTrendRows(NDaysToExtend, offset, nDate, nIndex, TestlineDate),
offset = offset + 1
}
else
Type.FunctionReturn
in
NewRow
My ultimate aim is to call this function recursively to add multiple rows I needed based upon the number of days.
And the output I get is like this:
Table1 with inserted row:
DateValue | Unique Dates | A.1 | B.1 | C.1 | D.1 | E.1 | F.1 | G.1 | H.1 | I.1 | J.1 | K.1 | L.1 | M.1 | Index | Testline Dates
5/30/2021 | 5/30/2021 | 23 | 12 | 34 | 12 | 34 | 45 | 65 | 76 | 23 | 45 | 67 | 23 | 34 | 0 | 5/30/2021
5/31/2021 | 5/31/2021 | 12 | 23 | 45 | 32 | 34 | 65 | 23 | 56 | 78 | 90 | 23 | 76 | 23 | 1 | 5/31/2021
Error | Error | Error | Error | Error | Error | Error | Error | Error | Error | Error | Error | Error | Error | Error | Error | Error
Note that the function needs to insert new row after the above two input rows and the offset I passed is 3, index is 2 and dates would be next incremented date. Rest other values passed are to be 0. I simply don't understand why the error is shown inside the inserted row if all values are passed correctly.
Any help would be appreciated.
Thanks
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 97 | |
| 73 | |
| 50 | |
| 46 | |
| 44 |