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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors