﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / Business Intelligence  / SSRS - Calculate $ cost on monthly basis / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 18 May 2013 12:24:37 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: SSRS - Calculate $ cost on monthly basis</title><link>http://www.sqlservercentral.com/Forums/Topic1400982-147-1.aspx</link><description>[quote][b]engg.pankaj (1/3/2013)[/b][hr]Thanks for the reply again.I know how to write SUM() and group by queries in T-SQL however, I want to know how to write this query and show the result in that particular column. If i right click on a column on the report, where do I write the query in it so that we can display the result of the query in that column.I am new to SSRS and need guidance.[/quote]You put your query in the Dataset area of the report.  First, make sure you have a data source that points to your database.  Then create a new dataset ([i]right click on Datasets and choose Add Dataset if you're creating your report in Report Builder -- it's similar in VS as well[/i]).  From here you can either go to the query designer, or just past in your query into the text &amp;#119;indow.Now in your tablix, make sure it's connected to that dataset ([i]in the tablix properties, Dataset name[/i]).  And then you can select the fields from your dataset for the columns of your report table.HTH,Rob</description><pubDate>Thu, 03 Jan 2013 08:00:20 GMT</pubDate><dc:creator>robert.gerald.taylor</dc:creator></item><item><title>RE: SSRS - Calculate $ cost on monthly basis</title><link>http://www.sqlservercentral.com/Forums/Topic1400982-147-1.aspx</link><description>Hi Robert,Thanks for the reply again.I know how to write SUM() and group by queries in T-SQL however, I want to know how to write this query and show the result in that particular column. If i right click on a column on the report, where do I write the query in it so that we can display the result of the query in that column.I am new to SSRS and need guidance.Thanks</description><pubDate>Thu, 03 Jan 2013 07:19:28 GMT</pubDate><dc:creator>engg.pankaj</dc:creator></item><item><title>RE: SSRS - Calculate $ cost on monthly basis</title><link>http://www.sqlservercentral.com/Forums/Topic1400982-147-1.aspx</link><description>[quote][b]engg.pankaj (1/2/2013)[/b][hr]Thanks for the reply Robert.So, do I alter the source table, add new column(s) which can hold the values for the sum of the month(s)?[/quote]No, you wouldn't need to alter the table, but rather just write a query.  Just sum up the values grouping by the month.  You would use the SUM() aggregate function and the GROUP BY clause.  Take a look at: [url][b]http://www.sql-tutorial.net/SQL-GROUP-BY.asp[/b][/url]for an intro on how group by works.Rob</description><pubDate>Thu, 03 Jan 2013 06:42:12 GMT</pubDate><dc:creator>robert.gerald.taylor</dc:creator></item><item><title>RE: SSRS - Calculate $ cost on monthly basis</title><link>http://www.sqlservercentral.com/Forums/Topic1400982-147-1.aspx</link><description>Thanks for the reply Robert.So, do I alter the source table, add new column(s) which can hold the values for the sum of the month(s)?</description><pubDate>Wed, 02 Jan 2013 09:01:59 GMT</pubDate><dc:creator>engg.pankaj</dc:creator></item><item><title>RE: SSRS - Calculate $ cost on monthly basis</title><link>http://www.sqlservercentral.com/Forums/Topic1400982-147-1.aspx</link><description>If you are able to edit the SQL then do as robert says. If you aren't good with SQL or are unable to edit the SQL for some reason then here's an idea:If the week field is a text datatype (not a true date) then you could create a calculated column as[code="other"]=Left(Fields!Week.Value,4)   [/code]This assumes that your weeks are as you've shown in your example, as either 3 or 4 letters followed by the day of the month. You will also want to include the year in the group, that's important if your report spans multiple years.If the week field is a proper date datatype then you can use this formula:[code="other"]=MonthName(Month(Fields!Week.Value),False)[/code]If you add a parent group to the details row, use that calculated column as the group. You can then add totals for the groups. If you right click on the $Sales_Item1 details cell it will give you the option to "add total".The results will look somewhat like this[code="other"]Month  Week   $Sales_Item1 Aug     Aug 20   1000        Aug 27   500Total            1500Sept    Sept 03  2000        Sep 10   100        Sep 17   0        Sep 24   0Total            2100[/code]If you really want it as per your example with the totals per month separate, then you can add a second tablix below and just use the grouping in it, i.e. change the details group to be grouped by month (see formulas above) and use something like [code="other"]=sum(Field!@Sales_item1.value) [/code]for each cell expression.</description><pubDate>Tue, 01 Jan 2013 22:05:52 GMT</pubDate><dc:creator>davoscollective</dc:creator></item><item><title>RE: SSRS - Calculate $ cost on monthly basis</title><link>http://www.sqlservercentral.com/Forums/Topic1400982-147-1.aspx</link><description>Rather than trying to do this in an expression, change your datasource and do it in T-SQL.  Much easier.Rob</description><pubDate>Mon, 31 Dec 2012 21:16:14 GMT</pubDate><dc:creator>robert.gerald.taylor</dc:creator></item><item><title>SSRS - Calculate $ cost on monthly basis</title><link>http://www.sqlservercentral.com/Forums/Topic1400982-147-1.aspx</link><description>I am new to SSRS and stuck at a point and can not move further and so need your helpI have a question regarding calculating sum of sales for different months.I have a report which shows weekly sales $ for east and west cost office. I have a report which shows weekly sales $ for east and west cost office. The datasource is a table which contains weekly sales data for the offices like:Week                   $ Sales_Item1              $ Sales_Item2              $ Sales_Item3Aug 20                         1000                   xyz                            abcAug 27                       500Sept 03                       2000etcetcetcReport needs to show info like:Week                  $ Sales_Item1              $ Sales_Item2            $ Sales_Item3Aug 20                  1000                       xyz                                abcAug 27                    500Sept 03                   2000etcetcetcSum $ for Aug        X     YSum $ for Sept      A      BHow do i calculate the sales for these individual items monthwise and show it on the report. What needs to be written in the "Expression" so as to get the sum of all 4 weeks data of the month?Please reply.Thanks</description><pubDate>Fri, 28 Dec 2012 10:55:59 GMT</pubDate><dc:creator>engg.pankaj</dc:creator></item></channel></rss>