Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • Thanks Mike! What if I don't know how many years I'm going to have? Commented Jun 17, 2014 at 23:39
  • That gets way more complex, because year is inferred by position in the a fixed length array. If for example, your data had no data for year 2013, but did for 2012 & 2014, then a group by would return an only 2 elements. So basically in order to ensure a fixed array size, the years have to be specified in some way, because it can always be inferred from the data. If you don't specify the years in linq you'd have to do it somewhere. I hope that makes sense. If you could change your data structure to include year & sum, this wold be much simpler. Commented Jun 17, 2014 at 23:54
  • So you're saying create a data structure with year and sum in it already and then use a different operation to pull out the data that I'm looking for? I've been playing with it, and I think I may have found the solution I'm looking for thanks to your help. I'll post the code in the solution Commented Jun 18, 2014 at 0:02