Showing results for 
Search instead for 
Did you mean: 

There weren't enough elements in the enumeration to complete the operation

I keep on receiving this error, and I don't do any pivoting with the data.  Not sure what's wrong, I've looked at all the threads with no help.


    Source = Excel.Workbook(File.Contents("L:\Industrial\13 - Data\Exports\ZGX"), null, true),
    Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Entry Date", type date}, {"Plate", type text}, {"Ticket number", Int64.Type}, {"Event status", type text}, {"Date", type date}, {"Time", type time}, {"Difference", type time}, {"Vehicle Type.", type text}, {"Initial Weight", Int64.Type}, {"Final Weight", Int64.Type}, {"Net Weight", Int64.Type}, {"Material", Int64.Type}}),
    #"Removed Columns1" = Table.RemoveColumns(#"Changed Type",{"Entry Date"}),
    #"Added Event Status Check" = Table.AddColumn(#"Removed Columns1", "Event Status Check", each if [Event status]="OPEN" then 1 else 0),
    #"Added Index" = Table.AddIndexColumn(#"Added Event Status Check", "Index", 1, 1),
    #"Added Next Event Status Check" = Table.AddColumn(#"Added Index", "Next Even Status Check", each #"Added Index"[Event Status Check]{[Index]}),
    #"Added TRT" = Table.AddColumn(#"Added Next Event Status Check", "TRT", each #"Added Next Event Status Check"[Difference]{[Index]}),
    #"Added Date Out" = Table.AddColumn(#"Added TRT", "Date Out", each #"Added TRT"[Date]{[Index]}),
    #"Added Time Out" = Table.AddColumn(#"Added Date Out", "Time Out", each #"Added Date Out"[Time]{[Index]}),
    #"Inserted Subtraction" = Table.AddColumn(#"Added Time Out", "Subtraction", each [Event Status Check] - [Next Even Status Check], type number),
    #"Filtered Rows" = Table.SelectRows(#"Inserted Subtraction", each ([Subtraction] = 1)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Event status", "Difference", "Event Status Check", "Index", "Next Even Status Check", "Subtraction"})
    #"Removed Columns"
Status: New
Community Support

Hi @Michael-


It looks like the Power Query is correct. Please update your Power BI desktop to the latest version 2.68.5432.661 then test again. 


If the issue still occurs, please share the source Excel file with some dummy data with us so we can test on our side. 


Best Regards,
Qiuyun Yu