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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Bokbob
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

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

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
Bokbob
Helper I
Helper I

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 ..

 

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

No am not aggregating on any of those columns

 

when i pivot my columns i picked dont aggregate option.

 

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.

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 🙂

 

@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

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

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

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors