<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Get an Average and a Sum in a Reporting Services Subtotal</title>
	<atom:link href="http://blog.boxedbits.com/archives/84/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.boxedbits.com/archives/84</link>
	<description>( ... more specifically about BI with Microsoft products )</description>
	<lastBuildDate>Wed, 01 Feb 2012 21:00:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Salman</title>
		<link>http://blog.boxedbits.com/archives/84/comment-page-1#comment-3664</link>
		<dc:creator>Salman</dc:creator>
		<pubDate>Wed, 18 Jan 2012 17:19:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=84#comment-3664</guid>
		<description>Thank you, i needed a way to display a Total and its column percentage as compared to the overall.
your example will guide me nicely.</description>
		<content:encoded><![CDATA[<p>Thank you, i needed a way to display a Total and its column percentage as compared to the overall.<br />
your example will guide me nicely.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KimS</title>
		<link>http://blog.boxedbits.com/archives/84/comment-page-1#comment-3617</link>
		<dc:creator>KimS</dc:creator>
		<pubDate>Tue, 22 Nov 2011 16:18:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=84#comment-3617</guid>
		<description>Bless you!  I&#039;m just learning SSRS and TOTALLY did not know and would never have guessed that subtotals can only SUM.  You helped me get the quarterly averages that were required on a report (that, incidently was supposed to have been written by a contractor, but forgotton/lost....)  Thanks to you this report is now ready!  And, thanks a lot for explaining the format codes!  Your article is the best--extrememly well written, documented and thorough.</description>
		<content:encoded><![CDATA[<p>Bless you!  I&#8217;m just learning SSRS and TOTALLY did not know and would never have guessed that subtotals can only SUM.  You helped me get the quarterly averages that were required on a report (that, incidently was supposed to have been written by a contractor, but forgotton/lost&#8230;.)  Thanks to you this report is now ready!  And, thanks a lot for explaining the format codes!  Your article is the best&#8211;extrememly well written, documented and thorough.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amir</title>
		<link>http://blog.boxedbits.com/archives/84/comment-page-1#comment-3611</link>
		<dc:creator>Amir</dc:creator>
		<pubDate>Wed, 09 Nov 2011 01:15:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=84#comment-3611</guid>
		<description>Thanks for the solution!

Just one reminder:

As Code.MatrixCellValue() is a custom code you need to add the following script in the code property of the report.

Report Property -&gt; code add the following script:

[code] Public Function MatrixCellValue(ByVal sumValue As Object, ByVal avgValue As Object, ByVal InScope As Boolean, ByVal sumFormat As String, ByVal avgFormat As String) As Object
        If InScope Then
            Return sumValue
        Else
            If Not avgValue Is Nothing Then
                Return String.Format(sumFormat, CDbl(sumValue)) + vbCrLf + String.Format(avgFormat, CDbl(avgValue))
            Else
                Return Nothing
            End If
        End If
    End Function
[/code]
Othervise you will recieve this error:
[b][BC30451] Name &#039;code&#039; is not declared.[/b]

Cheers,
Amir</description>
		<content:encoded><![CDATA[<p>Thanks for the solution!</p>
<p>Just one reminder:</p>
<p>As Code.MatrixCellValue() is a custom code you need to add the following script in the code property of the report.</p>
<p>Report Property -&gt; code add the following script:</p>
<p>[code] Public Function MatrixCellValue(ByVal sumValue As Object, ByVal avgValue As Object, ByVal InScope As Boolean, ByVal sumFormat As String, ByVal avgFormat As String) As Object<br />
        If InScope Then<br />
            Return sumValue<br />
        Else<br />
            If Not avgValue Is Nothing Then<br />
                Return String.Format(sumFormat, CDbl(sumValue)) + vbCrLf + String.Format(avgFormat, CDbl(avgValue))<br />
            Else<br />
                Return Nothing<br />
            End If<br />
        End If<br />
    End Function<br />
[/code]<br />
Othervise you will recieve this error:<br />
[b][BC30451] Name &#8216;code&#8217; is not declared.[/b]</p>
<p>Cheers,<br />
Amir</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Average Session Count by Day and Hour: The Report &#171; Edgesight Under the Hood</title>
		<link>http://blog.boxedbits.com/archives/84/comment-page-1#comment-3581</link>
		<dc:creator>Average Session Count by Day and Hour: The Report &#171; Edgesight Under the Hood</dc:creator>
		<pubDate>Wed, 17 Aug 2011 15:05:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=84#comment-3581</guid>
		<description>[...] of the subtotals, open the “report properties” and go to the code tab.  Based on a how-to from All About Business Intelligence add the following [...]</description>
		<content:encoded><![CDATA[<p>[...] of the subtotals, open the “report properties” and go to the code tab.  Based on a how-to from All About Business Intelligence add the following [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steph</title>
		<link>http://blog.boxedbits.com/archives/84/comment-page-1#comment-3576</link>
		<dc:creator>Steph</dc:creator>
		<pubDate>Fri, 17 Jun 2011 11:29:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=84#comment-3576</guid>
		<description>Nevermind..  got it working  :)
Great.. thanks</description>
		<content:encoded><![CDATA[<p>Nevermind..  got it working  <img src='http://blog.boxedbits.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Great.. thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steph</title>
		<link>http://blog.boxedbits.com/archives/84/comment-page-1#comment-3575</link>
		<dc:creator>Steph</dc:creator>
		<pubDate>Fri, 17 Jun 2011 11:15:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=84#comment-3575</guid>
		<description>Hi
I really hope you can help me get this working..  at the moment i&#039;m struggling to get the custom code section right.
I&#039;m assuming i need to change parts of the code you&#039;ve put in above to reflect my data/matrix?  and in the piece you past into the field code i need to change the groups and the field i&#039;m summing?

but i&#039;m not sure exactly how ;)   (Sorry.. I&#039;m new to reporting and VB code)

The matrix i have looks a little like this - 
		                                                =Fields!WeeksStartDate.Value
=Fields!Team.Value	=Fields!Technician.Value	***
       	                 =&quot;Sum&quot; + vbcrlf + &quot;Avg&quot;	

*** is the field where i&#039;ve put the following code in
=Code.MatrixCellValue(
                     Sum(Fields!Closed.Value),
                     Avg(Fields!Closed.Value),
                     InScope(&quot;&quot;matrix1_RowGroup2&quot;&quot;) and InScope(&quot;&quot;matrix1_WeekStartDate&quot;&quot;),
                     &quot;&quot;{0,6:N0}&quot;&quot;,
                     &quot;&quot;{0,6:N1}&quot;&quot;)&quot;


Does that look right?
How do i change the custom code to work with my matrix?

Sorry to be a pain..  and thanks for your time in advance  :)</description>
		<content:encoded><![CDATA[<p>Hi<br />
I really hope you can help me get this working..  at the moment i&#8217;m struggling to get the custom code section right.<br />
I&#8217;m assuming i need to change parts of the code you&#8217;ve put in above to reflect my data/matrix?  and in the piece you past into the field code i need to change the groups and the field i&#8217;m summing?</p>
<p>but i&#8217;m not sure exactly how <img src='http://blog.boxedbits.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />    (Sorry.. I&#8217;m new to reporting and VB code)</p>
<p>The matrix i have looks a little like this &#8211;<br />
		                                                =Fields!WeeksStartDate.Value<br />
=Fields!Team.Value	=Fields!Technician.Value	***<br />
       	                 =&#8221;Sum&#8221; + vbcrlf + &#8220;Avg&#8221;	</p>
<p>*** is the field where i&#8217;ve put the following code in<br />
=Code.MatrixCellValue(<br />
                     Sum(Fields!Closed.Value),<br />
                     Avg(Fields!Closed.Value),<br />
                     InScope(&#8220;&#8221;matrix1_RowGroup2&#8243;&#8221;) and InScope(&#8220;&#8221;matrix1_WeekStartDate&#8221;"),<br />
                     &#8220;&#8221;{0,6:N0}&#8221;",<br />
                     &#8220;&#8221;{0,6:N1}&#8221;")&#8221;</p>
<p>Does that look right?<br />
How do i change the custom code to work with my matrix?</p>
<p>Sorry to be a pain..  and thanks for your time in advance  <img src='http://blog.boxedbits.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maik</title>
		<link>http://blog.boxedbits.com/archives/84/comment-page-1#comment-3563</link>
		<dc:creator>Maik</dc:creator>
		<pubDate>Tue, 01 Mar 2011 21:58:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=84#comment-3563</guid>
		<description>Tom, thank you very much for this solution! 
Helped me a lot.</description>
		<content:encoded><![CDATA[<p>Tom, thank you very much for this solution!<br />
Helped me a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Denise</title>
		<link>http://blog.boxedbits.com/archives/84/comment-page-1#comment-3543</link>
		<dc:creator>Denise</dc:creator>
		<pubDate>Wed, 26 Jan 2011 18:54:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=84#comment-3543</guid>
		<description>I have a situation where I want to subtract the results of a column group from each other. For instance, each row of the matrix is  a different calculation of different fields and the column group is comprised of two dates the user enters as parameters (firstdate, seconddate). 

So, it looks something like this:

                                                                    Jan 1 2010        Jan 1 2011
#of Employers with medical participants                      58                     66   (a countdistinct)
# of Medical participants                                     250702              423960   (a count)
Average EE Premium                                          $164.86             $186.69  (an average)

How can I make a total row that subtacts the values in the column groups, for instance 66-58 = 8 as the #Difference. I also need a percentage calculation, so 66-58/58.   Also, since each row is a different calculation based on a different field in the dataset, this isn&#039;t a &quot;one expression fits all&quot; type of scenario for the total row. Is there any way to do this in SSRS 2005? Or, does it get any easier to add total rows in 2008 where they use a tablix structure instead of having only the option of a table or a matrix?

Any help would be most appreciated. I&#039;ve been driving myself nuts with this.</description>
		<content:encoded><![CDATA[<p>I have a situation where I want to subtract the results of a column group from each other. For instance, each row of the matrix is  a different calculation of different fields and the column group is comprised of two dates the user enters as parameters (firstdate, seconddate). </p>
<p>So, it looks something like this:</p>
<p>                                                                    Jan 1 2010        Jan 1 2011<br />
#of Employers with medical participants                      58                     66   (a countdistinct)<br />
# of Medical participants                                     250702              423960   (a count)<br />
Average EE Premium                                          $164.86             $186.69  (an average)</p>
<p>How can I make a total row that subtacts the values in the column groups, for instance 66-58 = 8 as the #Difference. I also need a percentage calculation, so 66-58/58.   Also, since each row is a different calculation based on a different field in the dataset, this isn&#8217;t a &#8220;one expression fits all&#8221; type of scenario for the total row. Is there any way to do this in SSRS 2005? Or, does it get any easier to add total rows in 2008 where they use a tablix structure instead of having only the option of a table or a matrix?</p>
<p>Any help would be most appreciated. I&#8217;ve been driving myself nuts with this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Pastrana</title>
		<link>http://blog.boxedbits.com/archives/84/comment-page-1#comment-3486</link>
		<dc:creator>David Pastrana</dc:creator>
		<pubDate>Fri, 04 Jun 2010 17:54:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=84#comment-3486</guid>
		<description>Hi! That&#039;s a good tip! But I need help about a similar problem:

    Let&#039;s think that you have some Categories and you are displaying the sales percentage in columns determinated by the month of the sale:

                     Jan  &#124;  Feb  &#124;  Mar  &#124;  Apr  &#124;  May  &#124;  Jun  
Category 1     10%   15%    20%    25%    30%    35%
Category 2     10%   15%    20%    25%    30%    35%
Category 3     10%   15%    20%    25%    30%    35%

    So, now you need to show a new column with the average of the Past 3 months sales percentage of each category, just like this:

                     Jan  &#124;  Feb  &#124;  Mar  &#124;  Apr  &#124;  May  &#124;  Jun  &#124;  P3M
Category 1     10%   15%    20%    25%    30%    35%   30%
Category 2     10%   15%    20%    25%    30%    35%   30%
Category 3     10%   15%    20%    25%    30%    35%   30%

    With the tip of this article, I have an idea to do this, but only to show the average of all the months and not only the last 3 months.

    Any sugestion will be helpful.

Best regards!</description>
		<content:encoded><![CDATA[<p>Hi! That&#8217;s a good tip! But I need help about a similar problem:</p>
<p>    Let&#8217;s think that you have some Categories and you are displaying the sales percentage in columns determinated by the month of the sale:</p>
<p>                     Jan  |  Feb  |  Mar  |  Apr  |  May  |  Jun<br />
Category 1     10%   15%    20%    25%    30%    35%<br />
Category 2     10%   15%    20%    25%    30%    35%<br />
Category 3     10%   15%    20%    25%    30%    35%</p>
<p>    So, now you need to show a new column with the average of the Past 3 months sales percentage of each category, just like this:</p>
<p>                     Jan  |  Feb  |  Mar  |  Apr  |  May  |  Jun  |  P3M<br />
Category 1     10%   15%    20%    25%    30%    35%   30%<br />
Category 2     10%   15%    20%    25%    30%    35%   30%<br />
Category 3     10%   15%    20%    25%    30%    35%   30%</p>
<p>    With the tip of this article, I have an idea to do this, but only to show the average of all the months and not only the last 3 months.</p>
<p>    Any sugestion will be helpful.</p>
<p>Best regards!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom VdP</title>
		<link>http://blog.boxedbits.com/archives/84/comment-page-1#comment-3430</link>
		<dc:creator>Tom VdP</dc:creator>
		<pubDate>Mon, 08 Mar 2010 13:16:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=84#comment-3430</guid>
		<description>Sure, since it is a string that is displayed in the cells, you could add as many values as needed.  Just add them as arguments to the &quot;MatrixCellValue&quot; function and in that function concatenate the values seperated by vbCrLf&#039;s.</description>
		<content:encoded><![CDATA[<p>Sure, since it is a string that is displayed in the cells, you could add as many values as needed.  Just add them as arguments to the &#8220;MatrixCellValue&#8221; function and in that function concatenate the values seperated by vbCrLf&#8217;s.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

