<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Bob's SQL Reporting Services Blog : Report Design</title><link>http://blogs.msdn.com/bobmeyers/archive/tags/Report+Design/default.aspx</link><description>Tags: Report Design</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Add Excel-like "color scale" conditional formatting to your reports</title><link>http://blogs.msdn.com/bobmeyers/archive/2009/07/31/add-excel-like-color-scale-conditional-formatting-to-your-reports.aspx</link><pubDate>Sat, 01 Aug 2009 03:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9854833</guid><dc:creator>bobmeyers</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/9854833.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=9854833</wfw:commentRss><description>&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;I’ve been meaning to do this for a long time, and it looks like David Lean &lt;A href="http://blogs.msdn.com/davidlean/archive/2009/02/17/sql-reporting-how-to-conditional-color-1-4-the-basics-report-expressions-custom-code.aspx" mce_href="http://blogs.msdn.com/davidlean/archive/2009/02/17/sql-reporting-how-to-conditional-color-1-4-the-basics-report-expressions-custom-code.aspx"&gt;beat me to it&lt;/A&gt; earlier this year by posting an incredibly thorough four-part discussion of how to do &lt;B style="mso-bidi-font-weight: normal"&gt;conditional formatting in Reporting Services&lt;/B&gt;. I’ve played with his sample code a bit and put together a variation on his theme that meets some additional requirements, which I have found helpful.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;The attached sample code is designed to provide the following functionality (the usual disclaimers apply):&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="FONT-FAMILY: Symbol; FONT-SIZE: 10pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Convenient support for the &lt;B style="mso-bidi-font-weight: normal"&gt;standard color scales&lt;/B&gt; available in Excel 2007&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; FONT-SIZE: 10pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Support for &lt;B style="mso-bidi-font-weight: normal"&gt;arbitrary colors&lt;/B&gt;, including named colors (“MintCream”)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; FONT-SIZE: 10pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Robust handling of &lt;B style="mso-bidi-font-weight: normal"&gt;null, error, and out-of-range &lt;/B&gt;values&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="FONT-FAMILY: Symbol; FONT-SIZE: 10pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Robust handling of all &lt;B style="mso-bidi-font-weight: normal"&gt;integral &lt;/B&gt;and&lt;B style="mso-bidi-font-weight: normal"&gt; floating point&lt;/B&gt; numeric types&lt;B style="mso-bidi-font-weight: normal"&gt; &lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;To use them in a report, do the following:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Open the &lt;B style="mso-bidi-font-weight: normal"&gt;Report Properties&lt;/B&gt; dialog (right-click on the space around the report body, choose Report Properties)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;On the &lt;B style="mso-bidi-font-weight: normal"&gt;Code&lt;/B&gt; page, paste in the attached code&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;On the &lt;B style="mso-bidi-font-weight: normal"&gt;References&lt;/B&gt; page, add a reference, click Browse, locate and select System.Drawing.dll, usually in C:\Windows\Microsoft.NET\Framework\v2.0.50727 (this references allows the code to handle named colors)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;The simplest and most common usage of these functions is to create a red-yellow-green&lt;B style="mso-bidi-font-weight: normal"&gt; “heat map”&lt;/B&gt; based on the value being displayed in the text box. This is done by setting the text box’s Fill color to an expression similar to the following:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;=Code.ColorScaleRYG(Sum(Fields!SalesAmount.Value), 0, 100000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;The arguments 0 and 100000 are the &lt;B style="mso-bidi-font-weight: normal"&gt;min&lt;/B&gt; and &lt;B style="mso-bidi-font-weight: normal"&gt;max&lt;/B&gt; values for the color scale. In this case, the &lt;B style="mso-bidi-font-weight: normal"&gt;ColorScaleRYG&lt;/B&gt; function is used, which assigns red to the low value, green to the high value, and yellow to the value half-way in between. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;The min and max values can also be &lt;B style="mso-bidi-font-weight: normal"&gt;calculated&lt;/B&gt;, like this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt 0.5in" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;=Code.ColorScaleRYG(Sum(Fields!SalesAmount.Value), Min(Fields!SalesAmount.Value, “Dataset1”), Max(Fields!SalesAmount.Value), “Dataset1”))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;The argument “Dataset1” defines the &lt;A href="http://msdn.microsoft.com/en-us/library/ms159673.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms159673.aspx"&gt;scope&lt;/A&gt; in which the min or max value is calculated, which must be a parent scope of the current scope.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Note that these colors are not the pure “Red”, “Green”, and “Yellow” colors defined in HTML/.NET/SSRS, but rather the default values used in Excel which are intended to provide a &lt;B style="mso-bidi-font-weight: normal"&gt;reasonable background&lt;/B&gt; for black text. If you don’t like them, it’s easy to specify your own colors instead.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Here’s a full list of the functions provided:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;‘ Convenience functions for standard 3-color scales&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleRYG(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleGYR(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleRYB(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleBYR(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleRWB(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleBWR(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;‘ Convenience functions for standard 2-color scales&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleRY(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleYR(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleGY(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleYG(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;‘ Arbitrary 3-color scale with interpolated midpoint value&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScale3(value as object, minValue as object, minColor as string, midColor as string, maxValue as object, maxColor as string) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;‘ Arbitrary 3-color scale with explicit midpoint value&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScale3(value as object, minValue as object, minColor as string, midValue as object, midColor as string, maxValue as object, maxColor as string) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;‘ Arbitrary 2-color scale with optional error color (the core function)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScale(value as object, minValue as object, minColor as string, maxValue as object, maxColor as string, optional errorColor as string = "Transparent") as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Enjoy!&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9854833" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/bobmeyers/attachment/9854833.ashx" length="4912" type="text/plain" /><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Builder/default.aspx">Report Builder</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Design/default.aspx">Report Design</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Presentation/default.aspx">Presentation</category></item><item><title>How to build a Clickthrough link in Report Builder 2.0</title><link>http://blogs.msdn.com/bobmeyers/archive/2009/03/05/how-to-build-a-clickthrough-link-in-report-builder-2-0.aspx</link><pubDate>Thu, 05 Mar 2009 18:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9460465</guid><dc:creator>bobmeyers</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/9460465.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=9460465</wfw:commentRss><description>&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;As I mentioned in a &lt;A title="previous post" href="http://blogs.msdn.com/bobmeyers/archive/2009/03/05/report-builder-2-0-whither-report-models.aspx"&gt;&lt;FONT color=#0000ff&gt;previous post&lt;/FONT&gt;&lt;/A&gt;, due to resource constraints in this release, Report Builder 2.0 is not a strict superset of RB 2005/1.0. One of the features missing from RB 2.0 is&amp;nbsp;automatic creation of &lt;A title="Clickthrough links" href="http://msdn.microsoft.com/en-us/library/ms345252.aspx"&gt;Clickthrough links&lt;/A&gt;. You can still get them, of course, by creating the basics of your report in RB 1.0, then saving and reopening in RB 2.0. It is also possible to build them manually.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Here's how:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 6pt 0in 10pt 0.5in; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Determine what the target entity should be. &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;This is the model entity the Clickthrough link should drill to. For example, if the value being displayed is # Sales Orders, you'll want to drill to the Sales Orders entity.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 6pt 0in 10pt 0.5in; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Get the target entity ID. &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;(This is the worst part) Unfortunately, this value is not accessible from within RB 2.0. You can see it in the&amp;nbsp;property grid in &lt;A title="Model Designer" href="http://msdn.microsoft.com/en-us/library/ms156256.aspx"&gt;Model Designer&lt;/A&gt;,&amp;nbsp;or you can get someone who has the &lt;A title="RS Script Utility" href="http://msdn.microsoft.com/en-us/library/ms162839.aspx"&gt;RS Script Utility&lt;/A&gt; to use the attached script to get a list of all the entity IDs in the model. Keep the list around for reference.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 6pt 0in 10pt 0.5in; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Determine whether to show a single-instance or multiple-instance report. &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;If the path from the value’s context to the target entity involves at least one “one-to-many” relationship, then the drill action can return multiple instances of the target entity, so you’ll need to show a multiple-instance report. Remember that the path from a report subtotal to the target entity is always one-to-many. Only use a single-instance report if there are no one-to-many relationships along the path. For example, if the value being displayed is # Sales Orders per Sales Territory, the value’s context is Sales Territory, and the path from that context to the target entity is Sales Territory -&amp;gt; Sales Person -&amp;gt; Sales Orders. Both of those relationships are one-to-many, so this Clickthrough action should use a multiple-instance report.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 6pt 0in 10pt 0.5in; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;4.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Create a "Go to report" action&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;. Open the property dialog for the Text Box, Placeholder, Chart Series, or other report element that has Action properties, and go to the Action property page. Select the “Go to report” option and use the following settings:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;
&lt;TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class=MsoNormalTable border=1 cellSpacing=0 cellPadding=0 class="MsoNormalTable"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 162.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" vAlign=top width=217&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Setting&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 315.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1" vAlign=top width=421&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 1"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 162.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=217&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Report Path&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 315.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=421&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;=DataSources!&lt;I style="mso-bidi-font-style: normal"&gt;MyDataSource&lt;/I&gt;.DataSourceReference&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 2"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 162.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=217&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Parameters&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 315.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=421&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Value&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 3"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 162.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=217&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;rs:EntityID&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 315.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=421&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;(Target entity ID)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 4"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 162.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=217&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;rs:DrillType&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 315.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=421&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;“Detail” or “List” for single- or multiple-instance, respectively&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 5"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 162.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=217&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;rs:Command&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 315.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=421&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;“Drillthrough”&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 6"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 162.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=217&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DrillthroughSourceQuery&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 315.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=421&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;=Datasets!&lt;I style="mso-bidi-font-style: normal"&gt;MyDataset&lt;/I&gt;.RewrittenCommandText&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 7; mso-yfti-lastrow: yes"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 162.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=217&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DrillthroughContext&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 315.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=421&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;=CreateDrillthroughContext()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt"&gt;A few tips:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: Symbol; FONT-SIZE: 8pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt"&gt;Clickthrough links will not work correctly in a “details” scope, i.e. a group with no grouping expression. If you want to use them in a scope that is currently a details scope, you’ll have to change it to a non-details scope by adding one or more grouping expressions that uniquely identify each row of data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: Symbol; FONT-SIZE: 8pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt"&gt;If the value you are displaying is an expression that involves multiple field references, set the target entity as the entity at the end of the longest common path between them.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l1 level1 lfo2" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: Symbol; FONT-SIZE: 8pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 8pt"&gt;Read up on how &lt;A href="http://blogs.msdn.com/bobmeyers/archive/2006/09/28/775767.aspx"&gt;creating customized Clickthrough reports&lt;/A&gt; can help maximize the value of every Clickthrough link you create.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9460465" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/bobmeyers/attachment/9460465.ashx" length="747" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Clickthrough/default.aspx">Clickthrough</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Builder/default.aspx">Report Builder</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Design/default.aspx">Report Design</category></item><item><title>Filtering on totals in Report Builder</title><link>http://blogs.msdn.com/bobmeyers/archive/2007/09/28/filtering-on-totals-in-report-builder.aspx</link><pubDate>Fri, 28 Sep 2007 17:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5189698</guid><dc:creator>bobmeyers</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/5189698.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=5189698</wfw:commentRss><description>&lt;P&gt;Since releasing Report Builder almost two years ago, we've found that many users run into difficulty at some point with &lt;STRONG&gt;filtering on totals&lt;/STRONG&gt;. A classic example of this is, "show me a list of customers with more than $5000 in Accessory sales." "Accessory sales" is a typical slice-and-dice filter, because it just eliminates detail or measure values (sales). It means, "include only the sales for products in the Accessory category." "More than $5000", on&amp;nbsp;the other hand,&amp;nbsp;is &lt;EM&gt;not &lt;/EM&gt;a typical slice-and-dice filter. It means, "include only the &lt;EM&gt;customers &lt;/EM&gt;for which the &lt;EM&gt;sales total &lt;/EM&gt;is more than $5000." In other words, the filter does not eliminate detail or measure values (sales), it eliminates groups instances (customers) based on a detail or measure &lt;EM&gt;total&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;Filtering on totals can be very handy at times. It is possible in an Excel PivotTable using the "Value Filters" context menu on the row or column labels (try it -- it's fun). It eliminates items from the row or column axis based on the value &lt;EM&gt;totals &lt;/EM&gt;at the outermost level. Filtering on totals is also possible at any level in Report Designer by adding group filters, although this is not always recommended, since it may mean requesting much more data in your query than your report really needs to display.&lt;/P&gt;
&lt;P&gt;Filtering on totals is also possible in Report Builder, but (a) there is only limited support for it, (b) it takes some training to ensure you build the right filter, and (c) in the case of RB-over-AS, the performance of the resulting queries will probably be unacceptable. Why is filtering on totals so hard right now? Because in this release RB was primarily designed and optimized for relational/operational&amp;nbsp;reporting. It has a number of innovative and powerful features that are especially valuable in this space (and unavailable in typical OLAP reporting, e.g. Excel). The reverse is also true: some features typical in OLAP reporting have only limited or no support in this release of RB. Filtering on totals is one of those features. There is still a large area of overlap, though (i.e., the extremely common "slice-and-dice" scenario), which is why we offer the option of RB-over-AS. However, users should realize that in this release there will be some challenges/limitations. Specifically, &lt;STRONG&gt;filtering on totals when using RB over AS will rarely result in acceptable performance.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;That said, let me go through a couple of examples to help explain what is possible, and what to watch out for.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Example 1: A botched report&lt;BR&gt;&lt;/STRONG&gt;The report we want is, "show me a list of customers with more than $5000 in Accessory sales" (same as above).&amp;nbsp;Conceptually this is fairly easy to think about, so many users will assume it must be easy to build. So they'll&amp;nbsp;just follow their nose&amp;nbsp;and build a report that has all the parts they think it needs, then hit "Run" and expect the right answer, like this:&lt;/P&gt;
&lt;P&gt;1. Create a new table report using the AdventureWorks sample report model&lt;BR&gt;2. Add Customer-&amp;gt;Customer Name to the report&lt;BR&gt;3. Add Customer-&amp;gt;Sales Orders-&amp;gt;Sales-&amp;gt;Sum Line Total to the report&lt;BR&gt;4. Open the Filter dialog&lt;BR&gt;5. Add Customer-&amp;gt;Sales Orders-&amp;gt;Sales-&amp;gt;Product-&amp;gt;Product Category to the filter, and set it to "Accessories"&lt;BR&gt;6. Add Sale-&amp;gt;Line Total to the filter, and set it to "greater than 5000".&lt;BR&gt;7. Close the filter dialog and run the report&lt;/P&gt;
&lt;P&gt;Looks like it should do the job, right? Nope. This report actually returns no data. What went wrong? &lt;/P&gt;
&lt;P&gt;Well, there are two problems. The first is that step 5 caused RB to change the primary entity of the report from Customer to Sale, based on the fact that the &lt;A class="" title="little checkbox at the bottom of the filter dialog" href="http://blogs.msdn.com/bobmeyers/archive/2007/01/15/using-that-little-checkbox-in-the-report-builder-filter-dialog.aspx" mce_href="http://blogs.msdn.com/bobmeyers/archive/2007/01/15/using-that-little-checkbox-in-the-report-builder-filter-dialog.aspx"&gt;little checkbox at the bottom of the filter dialog&lt;/A&gt; was checked. Changing the primary entity ensures the filter condition will filter all the &lt;EM&gt;values &lt;/EM&gt;added to our report, not just toss out some of the &lt;EM&gt;rows&lt;/EM&gt;. This would be perfect if all we were doing was slice-and-dice filtering. However, we are trying to filter on a total at the same time. This change in the primary entity means that the context of the report filter is now Sale instead of Customer, so the condition added in step 6 means "include only &lt;EM&gt;individual sales &lt;/EM&gt;where Line Total is greater than 5000" (notice that this change is reflected in the text at the top of the filter dialog, and later in the filter description on the surface of the report). As it turns out, there are no individual sales of a product in the Accessory category where the line total is greater than 5000, so we get no results.&lt;/P&gt;
&lt;P&gt;The second problem is that in step 6, we selected Line Total instead of Sum Line Total. This actually doesn't make a difference in this case because of the effect of the first problem, but it was nevertheless an issue because we weren't thinking about the fact that we wanted to filter on an &lt;EM&gt;aggregate &lt;/EM&gt;of Line Total in some other context (Customer), not the individual Line Total value attached to a single Sale. We shouldn't have expected to specify both filter conditions in the same place.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Example 2: Getting it right&lt;BR&gt;&lt;/STRONG&gt;This report is possible in RB using the approach described below, and has reasonable performance over a relational database (on AdventureWorks on my laptop, this report returns in &amp;lt;2 seconds). Be warned, however, that for a number of reasons,&amp;nbsp;running a report that uses this approach over AS will have performance ranging from disappointing to tragic.&lt;/P&gt;
&lt;P&gt;To do the same report as Example 1 correctly, we need to avoid making Sales the primary entity, because that would keep us from being able to specify a filter at the Customer level. We can accomplish this&amp;nbsp;by applying the slice-and-dice part of our filter directly to the displayed field instead of to the overall report. We can then reuse the filtered field to create a report-level filter condition in the context we want (Customer).&lt;/P&gt;
&lt;P&gt;1. Create a new table report based on the AdventureWorks sample report model.&lt;BR&gt;2. Add Customer-&amp;gt;Name to the report&lt;BR&gt;3. Add Customer-&amp;gt;Sales Orders-&amp;gt;Sales-&amp;gt;Sum Line Total to the report&lt;BR&gt;4. Right-click on the Sum Line Total field in the table, and choose Edit Formula (the Formula dialog opens)&lt;BR&gt;5. Double-click on the field reference in the formula to expand it&lt;BR&gt;6. Click on the link to add a filter on Sales&lt;BR&gt;7. Add&amp;nbsp;Sale-&amp;gt;Product-&amp;gt;Product Category to the filter, and set it to "Accessories"&lt;BR&gt;8. Click OK to close the Filter dialog.&lt;BR&gt;9. Check the box at the bottom of the Formula dialog to create a custom field using this formula, click OK, and name the field "Accessory Sales".&lt;BR&gt;11. Open the main Filter dialog&lt;BR&gt;12. Add the new "Accessory Sales" field to the filter, and set it to "greater than 5000"&lt;BR&gt;13. Close the Filter dialog and run the report&lt;/P&gt;
&lt;P&gt;Result:&amp;nbsp;A quick 1-page report showing customers with more than $5000 in accessory sales.&lt;/P&gt;
&lt;P&gt;So, that's great! Does that mean RB supports any kind of filtering on totals? No. You can filter on totals as long as (a) all the totals are in a single context, and (b) that context is the primary entity of the report. &lt;/P&gt;
&lt;P&gt;If you wanted to filter on totals in more than one context, such as&amp;nbsp;"show me customers grouped by territory, but only show customers with &amp;gt; $10000 in sales and territories with &amp;gt; $1M in sales acoss all customers", it wouldn't work, because you need a filter on the sales total for each customer &lt;EM&gt;and &lt;/EM&gt;the sales total for each territory. Note that this isn't possible in Excel either, since it only allows filtering on totals for the outermost group on an axis.&lt;/P&gt;
&lt;P&gt;If you wanted to filter on a total&amp;nbsp;in a context other than the primary entity, such as "show me customer sales&amp;nbsp;grouped by territory,&amp;nbsp;but only show territories with &amp;gt; $1M in sales",&amp;nbsp;that wouldn't work either, because you need to show values for each customer (which means Customer needs to be the primary entity), but filter on totals for each territory (which would not be the primary entity). This is possible in Excel, but note that if you add an outer group like Territory in Excel, you actually &lt;EM&gt;can't &lt;/EM&gt;do the report I described above, because it won't let you filter on a total for an inner group.&lt;/P&gt;
&lt;P&gt;Another, more common example is when you want to filter on a total at the lowest level of detail in the report, but&amp;nbsp;that doesn't happen to be an entity context, such as "show me monthly sales, but only months with &amp;gt; $1M in sales." This would work if Month were an entity, but chances are it isn't in your report model, and if not, you can't make it the primary entity, so you won't be able to filter on a total in that context (in this case, the primary entity would probably be Sales Order, where Order Date-&amp;gt;Month is defined). This is possible in Excel, because it doesn't distinguish between &lt;A class="" title="entity groups and value groups" href="http://blogs.msdn.com/bobmeyers/archive/2006/12/20/getting-grouping-right-in-report-builder.aspx" mce_href="http://blogs.msdn.com/bobmeyers/archive/2006/12/20/getting-grouping-right-in-report-builder.aspx"&gt;entity groups and value groups&lt;/A&gt;.&lt;/P&gt;
&lt;P mce_keep="true"&gt;So, what kind of filters can&amp;nbsp;you do in RB that you often can't do in OLAP reporting? Actually, a lot. RB supports an arbitrary number of filter conditions, "OR" groups, aggregate filter groups (e.g. "customers with&amp;nbsp;any orders where&amp;nbsp;Year=2004"), row filters that &lt;EM&gt;don't &lt;/EM&gt;filter the displayed values (e.g. "show customers and their &lt;EM&gt;total &lt;/EM&gt;sales, but only those with &amp;gt; $1000 sales in the last month), and independently filtered&amp;nbsp;fields (e.g. the "Accessory Sales" custom field we created in Example 2), including those with filters on multiple levels (e.g. "total sales with Product-&amp;gt;Category = "Accessories" and Sales Order-&amp;gt;Order Year = 2004"). All of these features help deliver a rich and powerful relational/operational reporting experience, which is what this release of RB was primarily designed to do.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Rest assured, however, that improving support for filtering on totals is still a high priority for the product team.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5189698" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/bobmeyers/attachment/5189698.ashx" length="7187" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Filters/default.aspx">Filters</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Grouping/default.aspx">Grouping</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Design/default.aspx">Report Design</category></item><item><title>Getting grouping right in Report Builder</title><link>http://blogs.msdn.com/bobmeyers/archive/2006/12/20/getting-grouping-right-in-report-builder.aspx</link><pubDate>Thu, 21 Dec 2006 02:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1334899</guid><dc:creator>bobmeyers</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/1334899.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=1334899</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;One thing Report Builder users need to be aware of when building a report is the difference between an &lt;B style="mso-bidi-font-weight: normal"&gt;entity group&lt;/B&gt;, which displays exactly one instance for each &lt;I style="mso-bidi-font-style: normal"&gt;row&lt;/I&gt; in the underlying table, and a &lt;B style="mso-bidi-font-weight: normal"&gt;value group&lt;/B&gt;, which displays one instance for each &lt;I style="mso-bidi-font-style: normal"&gt;distinct value&lt;/I&gt; of a particular field. The type of group they get depends on the field(s) they used to create the group initially. Problems can arise if the user intends to create an entity group with many fields, but instead creates a series of value groups (one for each field). This may make it impossible to get the sorting they want, and can introduce unwanted subtotals levels as well.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;For example, a user might drag in the Last Name field as the first step in creating an Employee report. However, if the DiscourageGrouping property for this field in the report model is "false", dragging in this field creates a &lt;EM&gt;value group &lt;/EM&gt;on Last Name. This means that the group cannot be used to display data about individual employees; it can only show totals for all employees with a given last name. So, other fields that are not totals (e.g. First Name) must be added to a new group. If they also do not discourage grouping, a value group will be created for them as well. And so on...&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;The safest way for the user to get an entity group when they really want one is to &lt;EM&gt;drag in the entity itself &lt;/EM&gt;from the entity list, instead of dragging in a field first. This will create an entity group displaying the &lt;A class="" href="http://blogs.msdn.com/bobmeyers/archive/2005/10/25/484895.aspx" mce_href="http://blogs.msdn.com/bobmeyers/archive/2005/10/25/484895.aspx"&gt;DefaultDetailAttributes&amp;nbsp;or IdentifyingAttributes&lt;/A&gt; for that entity. This is also a&amp;nbsp;convenient shortcut for adding the fields they almost certainly want to include anyway. As the developer of the report model, you can help users who are unaware of this trick by setting the DiscourageGrouping property in the report model on any field for which users are unlikely to want a value group. They can still get one in their report by using a custom field that simply references it, but the default behavior will give them an entity group instead.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1334899" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Grouping/default.aspx">Grouping</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Design/default.aspx">Report Design</category></item><item><title>How to get RB to load a report created in VS Report Designer</title><link>http://blogs.msdn.com/bobmeyers/archive/2006/09/28/how-to-get-rb-to-load-a-report-created-in-vs-report-designer.aspx</link><pubDate>Thu, 28 Sep 2006 20:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:775709</guid><dc:creator>bobmeyers</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/775709.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=775709</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Loading an arbitrary&amp;nbsp;Report Designer report in Report Builder is not supported in SQL Server 2005. However, if you are trying to make it work for some reason, here are a few tips:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;- Don't use page headers or footers&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;- Don't use rectangles or lists&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;- Only use a single data region (table, matrix, or chart)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;- Always bind the data region to a report model query&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;- Make sure the data region groups (including the Details group, which must always be present) *exactly* matches the groups in the query, both in number and sequence (left-to-right for table, rows then columns for matrix, category then series for chart).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;If you can get the report loaded, RB will add the appropriate&amp;nbsp;&lt;A href="http://msdn2.microsoft.com/en-us/library/ms345252.aspx"&gt;Clickthrough&lt;/A&gt; links when you save it back out.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=775709" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Design/default.aspx">Report Design</category></item><item><title>Using RDL expressions in Report Builder</title><link>http://blogs.msdn.com/bobmeyers/archive/2006/03/26/using-rdl-expressions-in-report-builder.aspx</link><pubDate>Sun, 26 Mar 2006 05:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:561147</guid><dc:creator>bobmeyers</dc:creator><slash:comments>13</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/561147.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=561147</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;While not a documented feature, you actually &lt;EM&gt;can &lt;/EM&gt;enter an arbitrary RDL expression into a textbox&amp;nbsp;in a&amp;nbsp;Report Builder report.&amp;nbsp;For example, you&amp;nbsp;could&amp;nbsp;add a textbox&amp;nbsp;that shows the date the report was run by setting the value of the textbox to the following:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT face=Arial size=2&gt;=String.Format("Date:&amp;nbsp;{0:MM/dd/yyyy}",&amp;nbsp;DateTime.Today)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Another&amp;nbsp;potential use of this undocumented feature is to display the values selected by the user for each report parameter. This is a helpful workaround for the fact that the auto-generated filter description does not insert the run-time values for each parameter. Here's an example of an RDL expression that would provide this info:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT face=Arial size=2&gt;=String.Format("Sales Year: {0}", Parameters!OrderYear.Value)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Note that you will have to guess the name of the report parameter generated by Report Builder. Typically it will be the name of the field used in the prompted filter condition, with any spaces removed.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;You cannot enter an RDL expression directly into a detail or subtotal cell in a table or matrix.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=561147" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Design/default.aspx">Report Design</category></item><item><title>Adding parameters (prompts) to a Report Builder report</title><link>http://blogs.msdn.com/bobmeyers/archive/2006/03/16/adding-parameters-prompts-to-a-report-builder-report.aspx</link><pubDate>Thu, 16 Mar 2006 06:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:552543</guid><dc:creator>bobmeyers</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/552543.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=552543</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;You easily can add basic parameters to a Report Builder report using the Filter dialog. For example, to let the user choose which year to view sales data for, add an&amp;nbsp;Order Year filter condition to your report filter, then, instead of specifying a value, click the "Order Year" label on the left side of the condition and choose "Prompt" from the menu. This will create a corresponding report parameter that will supply&amp;nbsp;the value when the report is run. If you also specify a value in the filter dialog, this value will be used as the default parameter value.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=552543" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Builder/default.aspx">Report Builder</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Design/default.aspx">Report Design</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Parameters/default.aspx">Parameters</category></item><item><title>The philosophy behind Report Builder data navigation</title><link>http://blogs.msdn.com/bobmeyers/archive/2005/10/15/the-philosophy-behind-report-builder-data-navigation.aspx</link><pubDate>Sat, 15 Oct 2005 09:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:481355</guid><dc:creator>bobmeyers</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/481355.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=481355</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;The top part of the Explorer pane in Report Builder is probably unlike anything&amp;nbsp;most people have&amp;nbsp;ever used. It starts out as a flat list of entities -- big "things" in your database like Customers, Orders, Products, etc. -- but then rearranges itself once you've added the first field to your report into an auto-collapsing, recursive&amp;nbsp;tree. What's really going on here? Why the new-fangled interface?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Well, the first issue is the peculiar role that the root of the tree plays in building your report. Whichever entity ends up as the root is the "primary" entity&amp;nbsp;of your report. One way to think of this is that the primary entity is the &lt;EM&gt;focus&lt;/EM&gt; of your report, e.g.&amp;nbsp;this report is fundamentally &lt;EM&gt;about&lt;/EM&gt; Customers. Thus, having selected that entity, all other data in your database is represented via its relationship to that entity. Database folks will quickly latch on here and suppose that the navigator is just displaying the tables and relationships in the underlying database. This is not quite true, and it misses the key to the navigator's power.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The key concept is that the nodes immediately below the root are not just the related entities. They represent &lt;EM&gt;the specific instances &lt;/EM&gt;of that entity that are related to a given instance of the root entity. Thus if Customer is the root entity, the Orders node immediately below it does not represent the Orders entity in general; it represents &lt;EM&gt;the&lt;/EM&gt; &lt;EM&gt;orders&lt;/EM&gt; &lt;EM&gt;placed by &lt;/EM&gt;a given customer.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;A good analogue would be a paper filing system with a card for each customer, followed by a folder of orders placed by that customer. There is no folder that contains all Orders -- there is just Customers &lt;EM&gt;and their &lt;/EM&gt;Orders.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;This explains why adding Customer-&amp;gt;Name to your report, and&amp;nbsp;then Customer-&amp;gt;Orders-&amp;gt;#Orders, results in a report that shows the Name of each Customer with the # of Orders &lt;EM&gt;for that customer&lt;/EM&gt;. No joining or filtering is necessary to constrain #Orders. It is all implicit in the navigation.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The fun really starts, though, when you realize that you can go &lt;EM&gt;anywhere&lt;/EM&gt; using these relationships (including back to the same entity, because the instances will be different), and the path you use fully describes and constrains exactly what data you are referring to. For example, the path Customer-&amp;gt;Orders-&amp;gt;Employee-&amp;gt;Territory-&amp;gt;Employees-&amp;gt;Orders-&amp;gt;OrderDetails-&amp;gt;Products represents the products from each order detail of each order taken by the employees in the same territory as the employees that took the orders of this customer. Now, that particular example may not be very useful in a practical sense, but you get the idea.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;This also explains why one should be very careful not to just drag in fields from any old node in the tree that looks like it&amp;nbsp;might be what you're looking for. The &lt;EM&gt;instances&lt;/EM&gt; of that entity to which your fields are referring will depend on the path you used to get there.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I'm curious what others think of this approach. Please comment or drop me a note if you have some thoughts you'd like to share on the subject.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=481355" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Design/default.aspx">Report Design</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Navigation/default.aspx">Navigation</category></item></channel></rss>