cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

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

Hi All, I have data coming from My SQL databse and i had to pivot the columns to make it in a readable format.

 

i have 2 colums with call_started & call_completed with UNIX datetime format. First i had to covert them to whole number format and then i managed convcert to proper date and time format by adding custom columns.

 

after i do that i cant save the query anymore and its giving me error as below. Please helpERROR.PNG

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Microsoft
Microsoft

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

Hi @Bokbob

The above error could occur when you pivot columns with same name, please check column  names in your data source. And there is a similar thread for your reference.

https://social.technet.microsoft.com/Forums/en-US/7923e025-a0c4-407b-bd0f-65959e5038bb/what-does-thi...


Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Helper I
Helper I

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

Thanks Everyone for your inputs.

 

After change type and after adding custom columns somehow its been adding duplicate columns. I could see it in numbers on bottom left hand side where it shows total columns and rows. then i knew that there was a duplicate one.

 

I went to table column options and choose remove duplicates and it removed thos duplicate columns and all good after that.

 

Phewww 🙂

 

View solution in original post

8 REPLIES 8
Highlighted
Helper I
Helper I

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

With my repeated tests i performed to see where it is going wrong.. i actually noticed that it is not liking it after we change the column type. it was text and i changed it to Whole number and then when i try to save and apply changes it comes up with that error message.

 

Also when i simply filter/remove some columns and apply changes it doesnt like it.

 

Any help is appriciated ..

 

Highlighted
Super User III
Super User III

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

Are you aggregating in the pivot-operation?

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Highlighted
Helper I
Helper I

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

No am not aggregating on any of those columns

 

when i pivot my columns i picked dont aggregate option.

 

Highlighted
Super User III
Super User III

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

OK, then this messages pops up if the remaining columns (those who are not unpivoted and are not in the values-section) don't provide a unique key to the result of the pivot.

The conversion could have eliminated unprintable characters or sth similar that produced duplicates in pairs of values who previously have been different. You can check this by counting the number of rows in both pivot-versions: If the later has less rows, you know that there have been dups in it.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Highlighted
Microsoft
Microsoft

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

Hi @Bokbob

The above error could occur when you pivot columns with same name, please check column  names in your data source. And there is a similar thread for your reference.

https://social.technet.microsoft.com/Forums/en-US/7923e025-a0c4-407b-bd0f-65959e5038bb/what-does-thi...


Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Helper I
Helper I

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

Thanks Everyone for your inputs.

 

After change type and after adding custom columns somehow its been adding duplicate columns. I could see it in numbers on bottom left hand side where it shows total columns and rows. then i knew that there was a duplicate one.

 

I went to table column options and choose remove duplicates and it removed thos duplicate columns and all good after that.

 

Phewww 🙂

 

View solution in original post

Highlighted
Advocate I
Advocate I

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

@Bokbob 

I found this post in looking for an answer to the same problem, but found the explanation did not fit my scenario. Here is a more complete explanation for the error:

 

The Pivot function is a group by operation. It requires a Pivot column and a Value column, all remaining columns can be considered as the GROUP BY columns. When there are multiple rows that will be collapsed by the group by, you have to specify the advanced option and chose an Aggregate Value Function.

 

In my case, I was working with string values, so left it as "Don't Aggregate", which resulted in the "too many elements" error. Changing the aggregate to MIN or MAX worked, but did not get me the results needed, but did explain why I was getting the error.

 

Unless you know your data set is only going to have one value per combo of Pivot Column and Group By columns, you need to specify an aggregate.

 

Hope that helps,

 

Clayton

Highlighted
Frequent Visitor

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

I had this situation and I added an Index column right at the start.

 

I had to remember to include the Index column in all subsequent operations to prevent strange outputs but it seems to work for my case.

 

Rich

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

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

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021