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