cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SHT
Regular Visitor

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

BI Picture 1.PNGPic 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 pic2BI Pic 2.PNGPic 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
Super User IV
Super User IV

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

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
Microsoft v-lionel-msft
Microsoft

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

Hi @SHT ,

 

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.

SHT
Regular Visitor

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

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.

SHT
Regular Visitor

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

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.

Microsoft v-lionel-msft
Microsoft

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

Hi @SHT ,

 

Maybe you can do like this:

eee13.PNG

.PBIX file 

You can refer to the applied steps in Edit Queries.

 

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.

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications