Use Linq to group and organise list of data in correct order

I have the following data table and i need to group it by quarters. I basically need to show Jan totals which will be including Jan Feb Mar then i need to show Apr totals which will include Apr May Jun and so on down the list. I also need to show offpeak and years in the same order

Answers


If you can "groom" your data so that the months are represented as an integer number 0 - 11, then you can group them into quarters by grouping on int(month / 3). Jan(0), Feb(1), March(2) div 3 all = 0. April(3), May(4), June(5) div 3 all = 1, etc. The Quarter number (Q1, Q2, etc) is int(month / 3) + 1

If the months are stored in the database as strings, you'll have to write a mapping function to reduce the string name to the month number (switch statement), and pray that this app is never used or seen by anyone other than English speakers. ;>


Need Your Help

Get space between footer and bottom of page blogger

css footer blogger

for some reason my Blogger page won't let me create transparent space between my footer and the bottom of the page. I would like the footer to moved up (tried both margin and padding, but nothing) so

SQL Server Geography type performance - Data trigger vs. Views

sql-server sql-server-2008 entity-framework sqlgeography

I am trying to use sys.geography type in SQL Server 2008 R2. I want to use this geograpy type for location based queries. For example, I pass in a location (as longitude and latitude variables) to a

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.