Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 months ago
Solved

Data source error: Expression

I face an error below when I do schedule refresh, I already prepared dataset with several elements below and not a single one is missed. But I always face this error.

 

Data source error: Expression.Error: There weren't enough elements in the enumeration to complete the operation.. #table({"Content", "Name", "Extension", "Date accessed", "Date modified", "Date created", "Attributes", "Folder Path", "Category", "Year", "Project Type", "Project Folder Name", "ProjectName", "Brand"}, {}). Microsoft.Data.Mashup.ErrorCode = 10063. Detail = #table({"Content", "Name", "Extension", "Date accessed", "Date modified", "Date created", "Attributes", "Folder Path", "Category", "Year", "Project Type", "Project Folder Name", "ProjectName", "Brand"}, {}). ;There weren't enough elements in the enumeration to complete the operation.. The exception was raised by the IDbCommand interface. Cluster URI: WABI-NORTH-EUROPE-redirect.analysis.windows.net Activity ID: 4b8399d2-bf3f-493e-af1e-752b1fb9e6aa Request ID: 88722c48-abc5-49ff-955a-f211d32ebccc Time: 2025-11-20 09:29:40Z

  • Hi Anonymous,

    The error message:
    Expression.Error: There weren't enough elements in the enumeration to complete the operation.
    indicates that Power Query is attempting to construct a table using #table(...) with a defined set of columns, but the list of rows provided is either empty or incorrectly structured. Even if all column headers are present, Power BI expects each row to contain the same number of elements as there are columns.

     

     

    My first suggestion: Try remove this part, after Brand field:  "Brand"}, {}


    If dont work:

    Recommended Approach

    1. Validate the structure of the row data before constructing the table.
    2. Ensure each row contains the correct number of elements corresponding to the column headers.
    3. Use conditional logic to handle empty or malformed data, for example:

     

    let
        rows = {...}, // list of lists containing data
        table = if List.IsEmpty(rows) then
            #table({"Column1", "Column2"}, {})
        else
            #table({"Column1", "Column2"}, rows)
    in
        table


    Maybe, if you could share part of your M script can be more helpfull.

    If this response was helpful in any way, I’d gladly accept a 👍much like the joy of seeing a DAX measure work first time without needing another FILTER.

    Please mark it as the correct solution. It helps other community members find their way faster (and saves them from another endless loop 🌀.

3 Replies

  • Hi Anonymous,

    The error message:
    Expression.Error: There weren't enough elements in the enumeration to complete the operation.
    indicates that Power Query is attempting to construct a table using #table(...) with a defined set of columns, but the list of rows provided is either empty or incorrectly structured. Even if all column headers are present, Power BI expects each row to contain the same number of elements as there are columns.

     

     

    My first suggestion: Try remove this part, after Brand field:  "Brand"}, {}


    If dont work:

    Recommended Approach

    1. Validate the structure of the row data before constructing the table.
    2. Ensure each row contains the correct number of elements corresponding to the column headers.
    3. Use conditional logic to handle empty or malformed data, for example:

     

    let
        rows = {...}, // list of lists containing data
        table = if List.IsEmpty(rows) then
            #table({"Column1", "Column2"}, {})
        else
            #table({"Column1", "Column2"}, rows)
    in
        table


    Maybe, if you could share part of your M script can be more helpfull.

    If this response was helpful in any way, I’d gladly accept a 👍much like the joy of seeing a DAX measure work first time without needing another FILTER.

    Please mark it as the correct solution. It helps other community members find their way faster (and saves them from another endless loop 🌀.

    • v-menakakota's avatar
      v-menakakota
      Community Support

      Hi Anonymous ,
      Thanks for reaching out to the Microsoft fabric community forum. 

       

      I would also take a moment to thank  Zanqueta  , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

      I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you .

       

       

      Best Regards, 
      Community Support Team  

      • v-menakakota's avatar
        v-menakakota
        Community Support

        Hi Anonymous ,
        I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you .

         

         

        Best Regards, 
        Community Support Team