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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
PascalT
Helper I
Helper I

[DAX] Pivot table - There were too many elements in the enumeration to complete the operation

Hi, well, i'm facing another challenge in the same order...

 

I want to reproduce the same kind of data manipulation but when i'm doing it, i've an error:

 

"Expression.Error: There were too many elements in the enumeration to complete the operation.
Details:
List"

 

I've another XML in which i've several fields.

Here is an example of a record of the XML. Note that i can have up to 20 fields.

 

<r>
   <p>
      <name>Name</name>
      <value>John doe</value>
   </p>
   <p>
      <name>Company</name>
      <value>my company</value>
   </p>
   <p>
      <name>Email</name>
      <value>my@email.com</value>
   </p>
   <p>
      <name>Phone</name>
      <value>phone</value>
   </p>
   <p>
      <name>Comments</name>
      <value>comment</value>
   </p>
   <p>
      <name>title</name>
      <value />
   </p>
   <p>
      <name>coursenumber</name>
      <value>61600006-01</value>
   </p>
</r>

 

I saw that some of the <name> Tags are sometime "Name*". In other words, we can have

<name>John</name>

and

<name*>John</name>

 

In PBI, i'm just interested by few fields, like name, country, email.. something like 5-10 fields maximum.

 

TC-1.PNG

 

So this is how my data looks like.

 and the query is: = Table.SelectRows(#"Expanded p", each [p.name] = "Company" or [p.name] = "Country" or [p.name] = "Email" or [p.name] = "First name" or [p.name] = "Last name" or [p.name] = "sitecore coursenumber")

 

So I want to do the same pivot mecanism.

1> I select the first column "p.name"

2> Pivot column

 

TC-2.PNG

 

> And then i got this:

 

TC-3.PNG

 

> And the error is:

 

TC-4.PNG

 

Do I do something wrong ? 

 

Thank you very Much

 

Pascal

 

2 REPLIES 2
Brett007
Helper III
Helper III

The problem is that there is more than one value that is associated with the pivoted column.  You could choose Max, Min etc but you would loose data.  I am trying to figure out the same issue.  I would like to turn the data into a Comma Seperated List, but I am not successful yet.

 

This is how I solved the issue:

= Table.Group(#"Reordered Columns", {"Grouped by Item 1", "Grouped By Item 2"}, {{"Contents", each Text.Combine(_[User Name],","), type text}})

 

Not sure if that is helpful enough.  I just needed to add a comma seperated data column for the items that had more than one. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors