Forum Discussion

Heetesh's avatar
Heetesh
Regular Visitor
5 months ago
Solved

An error occurred while processing the semantic model refresh in Desktop power BI and on Service

Data source error: Expression.Error: There weren't enough elements in the enumeration to complete the operation.. {error "Microsoft.Mashup.Engine1.Runtime.ValueException: [Expression.Error] Value was...
  • MohdZaid_'s avatar
    5 months ago

    Hey Heetesh , 

    This error is coming from Power Query, not from DAX or the Power BI Service itself. The message “There weren’t enough elements in the enumeration” usually means that somewhere in your query, Power BI is trying to access a value from a list, row, or column that does not exist. In simple terms, the query expects some data to be there, but during refresh it finds nothing or something different.

     

    A very common reason for this is when the query tries to access the first row using something like {0} or expands a merged table assuming rows are available. If the source returns zero rows at refresh time, Power Query throws this error. Another common cause is when a column was renamed, removed, or its structure changed in the source system, but your transformation steps still reference the old structure.

     

    Since the error is happening both in Desktop and in the Service, it confirms that the issue is in the Power Query transformation logic, not in the gateway or cloud environment. The best way to fix it is to open Power Query Editor in Desktop, go through the Applied Steps one by one, and identify exactly which step is failing. Most of the time, the issue appears during a Merge, Expand, Custom Column, or index-based extraction step.

     

    Once you identify the problematic step, you can fix it by adding proper error handling, such as using try … otherwise null, or by adjusting the logic so it does not assume that data will always be present. It is also a good idea to confirm with your database team whether any schema changes were made recently, such as removed columns or modified views.

     

    In short, the problem is caused by a transformation step that expects data in a specific structure, but during refresh that structure is not fully available. Reviewing and making the query more defensive will resolve the issue.

     

    If this explanation helped, please mark it as the solution so others can find it easily.

    If it helped, a quick Kudos is always appreciated it highlights useful answers for the community.

    Thanks for being part of the discussion!