Thursday, February 16, 2012

Can Reporting Server do this?

I have a simple database see below and I would like the outcome group by
month with subtotal. How do I write the query and then use Reporting Server
to genereate a report like the following?
Data in database:
--
Datetime Amount
1/1/2005 1400
1/1/2005 1600
2/1/2005 800
2/5/2005 600
Report outcome:
--
January
1/1/2005 1400
1/1/2005 1600
Subtotal : 3000
Febuary
2/1/2005 800
2/5/2005 600
Subtotal: 1400Create a report containing the dataset from your database. Create a field
that only shows the month of your DateTime and then group it by that field
(Month) and include subtotals.
If you create a view that strips out the month in your datetime, then you
should be able to achieve your result by using the report wizard.
I know Crystal Reports has the ability to group by datetime based on
month/week/daily basis, but I am not sure if that functionality is in RS.
"Zean Smith" <nospam@.nospamaaamail.com> wrote in message
news:UqqdnbKEK4HT5g3eRVn-jA@.rogers.com...
>I have a simple database see below and I would like the outcome group by
>month with subtotal. How do I write the query and then use Reporting
>Server to genereate a report like the following?
> Data in database:
> --
> Datetime Amount
> 1/1/2005 1400
> 1/1/2005 1600
> 2/1/2005 800
> 2/5/2005 600
>
> Report outcome:
> --
> January
> 1/1/2005 1400
> 1/1/2005 1600
> Subtotal : 3000
> Febuary
> 2/1/2005 800
> 2/5/2005 600
> Subtotal: 1400
>|||Thanks Pedro!! To help other people.. here is the Query I used:
By using DataName and DatePart in SQL query:
SELECT DATENAME(mm, DateTime) + ', ' + CAST(DATENAME(yyyy, DateTime) AS
varchar(4)) AS MonthYearName, DATEPART(yyyy, DateTime) AS Year,
DATEPART(mm, DateTime) AS Month, *
FROM CorporateSales
Then, in Reporting Server, add the GROUP and then group the data by Month,
and by Year.
Add "MonthYearName" in header.
Add "Subtotal" in footer.
I will be able to show exactly what I wanted in the first place.
"Pedro" <pedro@.newsgroups.nospam> wrote in message
news:e16lK2J%23FHA.3308@.TK2MSFTNGP11.phx.gbl...
> Create a report containing the dataset from your database. Create a field
> that only shows the month of your DateTime and then group it by that field
> (Month) and include subtotals.
> If you create a view that strips out the month in your datetime, then you
> should be able to achieve your result by using the report wizard.
> I know Crystal Reports has the ability to group by datetime based on
> month/week/daily basis, but I am not sure if that functionality is in RS.
> "Zean Smith" <nospam@.nospamaaamail.com> wrote in message
> news:UqqdnbKEK4HT5g3eRVn-jA@.rogers.com...
>>I have a simple database see below and I would like the outcome group by
>>month with subtotal. How do I write the query and then use Reporting
>>Server to genereate a report like the following?
>> Data in database:
>> --
>> Datetime Amount
>> 1/1/2005 1400
>> 1/1/2005 1600
>> 2/1/2005 800
>> 2/5/2005 600
>>
>> Report outcome:
>> --
>> January
>> 1/1/2005 1400
>> 1/1/2005 1600
>> Subtotal : 3000
>> Febuary
>> 2/1/2005 800
>> 2/5/2005 600
>> Subtotal: 1400
>>
>

No comments:

Post a Comment