Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi,
When adding a pivot table step in dataflow, we receive the message that "There was a problem refreshing your dataflow". At the error details, show the following message:
"Expression.Error: There were too many elements in the enumeration to complete the operation."
It works fine in Power Query Online and when copying to the Power BI Desktop, it works fine too.
Follow the M code of the query:
let
Source = Excel.Workbook(Web.Contents("-"), null, true),
Custom = Table.AddColumn(Source, "Custom", each Table.PromoteHeaders([Data])),
#"Custom 1" = Table.Combine(Custom [Custom]),
#"Changed column type" = Table.TransformColumnTypes(#"Custom 1", {{"1", type text}, {"2", type text}, {"3", type text}, {"4, type text}, {"5", type text}}),
#"Pivoted Column" = Table.Pivot(#"Changed column type", List.Distinct(#"Changed column type"[#"Attribute Description"]), "4", "5"),
#"Removed Duplicates" = Table.Distinct(#"Pivoted Column", {"1"}),
#"Removed blank rows" = Table.SelectRows(#"Removed Duplicates", each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null}))),
#"Filtered Rows" = Table.SelectRows(#"Removed blank rows", each [1] <> "" and [1] <> null)
in
#"Filtered Rows"
There is no date columns and when removing the Table.Pivot step, it works fine.
Can you help us please?
Thank you very much
Solved! Go to Solution.
Hi @leews
all the roads lead to duplicate column names or according @ImkeF post here https://community.powerbi.com/t5/Power-Query/There-were-too-many-elements-in-the-enumeration-to-comp...
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.
check it
The difference in PQ online, desktop and service behaviour is because desktop uses only preview of data
Hi @leews
all the roads lead to duplicate column names or according @ImkeF post here https://community.powerbi.com/t5/Power-Query/There-were-too-many-elements-in-the-enumeration-to-comp...
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.
check it
The difference in PQ online, desktop and service behaviour is because desktop uses only preview of data
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 29 | |
| 23 | |
| 17 | |
| 16 | |
| 14 |