Forum Discussion
Expression.Error: There weren't enough elements in the enumeration to complete the operation
This depends on what you're doing: Please copy the code from the advanced editor here to investigate.
So forgive me, when I mentioned I was new, I'll show my ignorance. What are you referring to specifically when you say code? Is this the source that I'm linked to?
- v-yulgu-msft9 years ago
Microsoft Employee
Hi Seaweed81,
The code mentioned by ImkeF was the Power Query code. You can get it via clicking the Advanced Editor in Query editor mode.
What changes did you make after loading data into Power BI desktop? And whcih step caused above error? Was there any more detailed error message?
Best regards,
Yuliana Gu- cdspeights9 years agoRegular Visitor
There were no changes made. I technically created this, but am also somewhat new as well. I am a bit more advanced in regards to the questions, however.
There were no changes made (outside of some transformations for cleanup, no pivots, etc). We are connecting to a stats page. There are multiple queries for different stats/scenarios. The easiest way to get this to work with no fuss is to delete all relationships, refresh, then go back and connect the relationships. But, this is getting cumbersome as we add more and more tables/queries. The other thing important to mention is, it's never the same table that receives the error. Based on all I have read about the error, it appears to have something to do with pivoted data that creates duplicates. I will post the code, but on a different machine at the moment and is only in the .pbix file.
- cdspeights9 years agoRegular Visitor
Here is the error message.
This is the information from the advanced editor:
let
Source = Web.Page(Web.Contents("http://www.fangraphs.com/leaders.aspx?pos=all&stats=bat&lg=all&qual=0&type=c,21,23,34,35,40,41,43,44,45,47,50,54,73&season=2017&month=14&season1=2017&ind=0&team=0,ts&rost=&age=0&filter=&players=0")),
Data11 = Source{11}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data11,{{"Header", type text}, {"#", Int64.Type}, {"Team", type text}, {"SB", Int64.Type}, {"AVG", type number}, {"BB%", Percentage.Type}, {"K%", Percentage.Type}, {"ISO", type number}, {"BABIP", type number}, {"LD%", Percentage.Type}, {"GB%", Percentage.Type}, {"FB%", Percentage.Type}, {"HR/FB", Percentage.Type}, {"wOBA", type number}, {"wRC+", Int64.Type}, {"Hard%", Percentage.Type}}),
#"Removed Other Columns" = Table.SelectColumns(#"Changed Type",{"Team", "SB", "AVG", "BB%", "K%", "ISO", "BABIP", "LD%", "GB%", "FB%", "HR/FB", "wOBA", "wRC+", "Hard%"}),
#"Added Custom" = Table.AddColumn(#"Removed Other Columns", "Versus", each "RH")
in
#"Added Custom"