Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

There were too many elements in the enumeration to complete the operation.

Pic 1Pic 1

 

My current data looks like the above image and I want to have all the rows in the column ProjectID without any duplicates. I tried to unpivot and pivot the data and ended with pic2Pic 2Pic 2

Although I got the required format, I get the error "There were too many elements in the enumeration to complete the operation". As you can see, it displays the non-duplicate rows but gives errors for the rest.

I looked at other threads with the same problem but it did not work out. Any help is appreciated. Thank you.

5 REPLIES 5
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Error: "There were too many elements in the enumeration to complete the operation"

This error is because another column is not aggregated when you Pivot column.(When there are duplicate columns in your table.)

bbb4.PNG

bbb5.PNGbbb6.PNG

 

You can try using the "Remove Duplicates" feature.

bbb7.PNG

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hello @v-lionel-msft 

 

Thank you your reply. The program ID in the picture has sub programs with IDs and each sub program has different country, region, donor etc. If I use remove dupliactes I will lose the sub project information. Please imagine a hierarchy where program is the top one and it has sub programs with respective info. I want all of these columns to correspond to one Program ID in a single row. I do not anyway need sub program ID in the end but let's take countries column for example. It should display all countries that belong to this program. In the same way, all the other columns should also correspond to the program ID.

Before : 50000    1            US              A 

                           2            UK              B

                           3            US              A

After: 50000                     US,UK          A,B

I hope I made it clear. Thank you.

Hi @Anonymous ,

 

Maybe you can do like this:

1.  Remove [Column2]

aaaa6.PNG

2. Select columns 1 and 3 at the same time and delete duplicate columns, you can get this:

aaaa7.PNG

3. Transpose the table:

aaaa8.PNG

3. Merge the two columns:

aaaa9.PNG

4. Transpose the table again:

aaaa10.PNG

5. Replae the value:

eee13.PNG

You can refer to the applied steps in Edit Queries.

aaaa11.PNG

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

GilbertQ
Super User
Super User

Could I ask why you are trying to get all the columns?

What if you tried it on a subset of the columns to see if there is a particular row causing the issue?

You can do this by possibly filtering it out to a row which has valid data and see if you can enumerate that column as expected.

If that works then at least you have a point to further debug.

Also you can have a look at the Query Diagnostics to see what that says when Power Query is running.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Anonymous
Not applicable

Hello @GilbertQ 

 

Thank you for you reply. I want to have one line per every project. I do not want any duplicates in the projectIDS and want all the other columns to correspond to the respective proejct. As I mentioned in the post, it displays all the rows (projects) which are single or do not have any duplicates. All the other rows (or projectIds) with multiple mentions are displaying errors.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.