Forum Discussion
Expression.Error: There weren't enough elements in the enumeration to complete the operation
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"
- ImkeF9 years ago
Community Champion
There doesn't seem to be an issue with that query. Its showing perfect results on my machine:
But this query doesn't have any pivot-operation. So maybe you've copied the code from the wrong query?
- cdspeights9 years agoRegular Visitor
ImkeF No, that was the right one. That's the rub...it does work "a lot" of the time, but randomly decides to throw that enumeration error. Is it possible the data source could cause an issue? I just ask because I know that site is sometimes very slow in loading, so wondering if something on the server side could cause the issue?
If you're saying nothing is wrong with it, I believe that. I have been telling Seaweed81 that I felt the model was fine, it was an issue on the data side, though I didn't know how to verify this assumption...
- ImkeF9 years ago
Community Champion
Yes, this could be a reason: If your source data don't come in, the subsequent queries will fail as well.
You can implement error-handling mechanisms with try ... otherwise.