Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Data for every month of a selected year.

Author  Topic 

Lonay
Starting Member

1 Post

Posted - 2011-01-13 : 09:06:48
Im working in Microsoft SQL Server Report Builder 2.0, and im having trouble finding a way to be able to choose a specific year and have data showing at ech of the months. I'd like to be able to have a diagram that shows me at the horizontal the months, and the vartical the data would be shown.

My current solution is very inflexible because of the fact that i need to do this at several years and all for different data.

This is how the code looks:

declare @datum as datetime

set @datum = '2010-01-01'

select elanlaggningar.AnlaggningId, test.Januari from elanlaggningar
left JOIN (SELECT AnlaggningId As Januari FROM csElCurrentDatum(@Datum) C WHERE C.NatKundId>0) as test
ON elanlaggningar.AnlaggningId = test.Januari

This Shows the overall data from AnlaggningId, then for 2010-01-01 at januari it selects every data from that data and makes the ones who dosn't belong to the current date to NULL.

Anyone with a better solution or do i have to make a request for every single data i have for about 5 years?



visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-13 : 11:02:38
at any time is amount of columns you need to show fixed? till what point backwards from current year you need to show the data?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -