<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A Developer&#039;s Blog &#187; SSRS</title>
	<atom:link href="http://blog.hoegaerden.be/tag/ssrs/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hoegaerden.be</link>
	<description>SQL Server, BI, .NET, IT and anything else I have been playing with.</description>
	<lastBuildDate>Wed, 01 Feb 2012 16:15:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Changing Parameter Order In An SSRS Report</title>
		<link>http://blog.hoegaerden.be/2011/04/29/changing-parameter-order-in-an-ssrs-report/</link>
		<comments>http://blog.hoegaerden.be/2011/04/29/changing-parameter-order-in-an-ssrs-report/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 16:06:44 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[Reporting Services 2008]]></category>
		<category><![CDATA[Reporting Services 2008 R2]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2011/04/29/changing-parameter-order-in-an-ssrs-report/</guid>
		<description><![CDATA[This week I was asked twice, by two different (luckily) colleagues, if I knew how to change the order of the parameters in a report in SQL Server Reporting Services.  I still remember that the first time when I needed this after my upgrade to 2008, I also spent some time looking for it.  Apparently [...]]]></description>
			<content:encoded><![CDATA[<p>This week I was asked twice, by two different (luckily) colleagues, if I knew how to change the order of the parameters in a report in SQL Server Reporting Services.  I still remember that the first time when I needed this after my upgrade to 2008, I also spent some time looking for it.  Apparently it’s still hard to find so I’ve now decided to write a quick post about it.  I promise you, once you know it you’ll say “how silly”.</p>
<p>The following screenshot should say it all:</p>
<p><img style="display: inline; border: 0px;" title="Use the arrows in the Report Data pane to move parameters up or down" src="http://blog.hoegaerden.be/wp-content/uploads/image406.png" border="0" alt="Use the arrows in the Report Data pane to move parameters up or down" width="177" height="250" /></p>
<p>That’s right, those two small arrow buttons in the Report Data pane can be used to move the parameters up or down.  They may be difficult to spot but once you’ve found them you’ll never forget.  Why are they difficult to spot?</p>
<p><img style="display: inline; border: 0px;" title="Move Up/Down buttons greyed out" src="http://blog.hoegaerden.be/wp-content/uploads/image407.png" border="0" alt="Move Up/Down buttons greyed out" width="170" height="45" /></p>
<p>For several reasons:</p>
<ul>
<li>they are greyed out when no parameter is selected</li>
<li>they may not be visible when your Report Data pane is too small</li>
</ul>
<p>How silly huh?</p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><strong>References</strong></p>
<p><a title="How to: Change the Order of a Report Parameter (Reporting Services)" href="http://msdn.microsoft.com/en-us/library/cc281392.aspx" target="_blank">How to: Change the Order of a Report Parameter (Reporting Services)</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2011%2F04%2F29%2Fchanging-parameter-order-in-an-ssrs-report%2F&amp;title=Changing%20Parameter%20Order%20In%20An%20SSRS%20Report" id="wpa2a_2"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2011/04/29/changing-parameter-order-in-an-ssrs-report/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Where The Sheets Have A Name</title>
		<link>http://blog.hoegaerden.be/2011/03/23/where-the-sheets-have-a-name-ssrs-excel-export/</link>
		<comments>http://blog.hoegaerden.be/2011/03/23/where-the-sheets-have-a-name-ssrs-excel-export/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 18:38:50 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[Reporting Services 2008 R2]]></category>
		<category><![CDATA[SSRS]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2011/03/23/where-the-sheets-have-a-name-ssrs-excel-export/</guid>
		<description><![CDATA[Did you know that as of SQL Server Reporting Services 2008 R2 you can give the worksheets a customized name when exporting your report to Excel?  If you didn’t, or you did but never took the time to find out how you’d implement that, I’ll show you here and now! For this example I’ll be [...]]]></description>
			<content:encoded><![CDATA[<p>Did you know that as of <strong>SQL Server Reporting Services 2008 R2</strong> you can give the worksheets a customized name when exporting your report to Excel?  If you didn’t, or you did but never took the time to find out how you’d implement that, I’ll show you here and now!</p>
<p>For this example I’ll be starting off from the report created in <a title="Cascading Calculated Fields (SSRS)" href="http://blog.hoegaerden.be/2011/03/07/cascading-calculated-fields-ssrs/">my earlier post on Cascading Calculated Fields</a>.</p>
<p>The result can be <a title="NamingExcelSheets.rdl" href="http://cid-81c8b064cbbe1698.office.live.com/self.aspx/.Public/blog/NamingExcelSheets.rdl" target="_blank">downloaded from my Skydrive through this link</a>.</p>
<h2>The Scenario</h2>
<p>As you may recall, our report shows a list of all our company’s products.  When the report gets exported to Excel, each product category should get its own sheet.  So all products from the Audio category should be located in a sheet called “Audio”, all Games and Toys in a sheet called “Games and Toys”, and so on.</p>
<h2>The Report</h2>
<h3>Starting Position</h3>
<p>Let’s first have a quick look what the export to Excel currently looks like, without any modifications to the report.</p>
<p><img style="display: inline; border-width: 0px;" title="Default export to Excel - all data in one sheet" src="http://blog.hoegaerden.be/wp-content/uploads/image379.png" border="0" alt="Default export to Excel - all data in one sheet" width="700" height="639" /></p>
<p>All records are being exported to just one sheet.  And, by default, the name of the sheet is the name of the report.  (I made a copy of my existing report and called it NamingExcelSheets.rdl.)</p>
<p>In case you want to change the default name of the sheet, it’s possible.  On the report itself, there’s a property called <strong>InitialPageName</strong>.</p>
<p><img style="display: inline; border-width: 0px;" title="Use the InitialPageName property on the report to change the default name of the Excel sheet" src="http://blog.hoegaerden.be/wp-content/uploads/image380.png" border="0" alt="Use the InitialPageName property on the report to change the default name of the Excel sheet" width="428" height="437" /></p>
<p>Fill in a value and here’s the result in Excel:</p>
<p><img style="display: inline; border-width: 0px;" title="The Excel sheet with its default name changed to a very unique name" src="http://blog.hoegaerden.be/wp-content/uploads/image381.png" border="0" alt="The Excel sheet with its default name changed to a very unique name" width="667" height="457" /></p>
<h3>Adding The Category Group</h3>
<p>To be able to get the different categories into different sheets, we need to add a group on Category to the tablix in the report.</p>
<p>With the tablix selected, right-click the <em>Details </em>line in the <em>Row Groups </em>pane and select <strong>Add Group &gt; Parent Group</strong>.  Select ProductCategoryName as field to group by and activate the <strong>Add group header</strong> checkbox.</p>
<p><img style="display: inline; border-width: 0px;" title="Add group on Product Category" src="http://blog.hoegaerden.be/wp-content/uploads/image382.png" border="0" alt="Add group on Product Category" width="682" height="320" /></p>
<p>Remove the group column that gets added automatically and move the header cells from the main header to the group header.  Delete the main header row so that you end up with something like this:</p>
<p><img style="display: inline; border-width: 0px;" title="Tablix with group on Product Category added" src="http://blog.hoegaerden.be/wp-content/uploads/image383.png" border="0" alt="Tablix with group on Product Category added" width="580" height="93" /></p>
<p>Open up the <strong>Group Properties </strong>by double-clicking the new ProductCategoryName item in the <em>Row Groups </em>pane.  Select the <em>Page Breaks </em>page and activate the <strong>Between each instance of a group </strong>checkbox.  Doing this ensures that each group gets its own page in the report, and its own sheet in Excel.</p>
<p><img style="display: inline; border-width: 0px;" title="Adding page breaks between the instances of a group" src="http://blog.hoegaerden.be/wp-content/uploads/image384.png" border="0" alt="Adding page breaks between the instances of a group" width="585" height="482" /></p>
<p>Let’s render the report and export to Excel to have a look at the effect of adding these page breaks.</p>
<p><img style="display: inline; border-width: 0px;" title="Report exported to Excel with each group in a separate sheet" src="http://blog.hoegaerden.be/wp-content/uploads/image385.png" border="0" alt="Report exported to Excel with each group in a separate sheet" width="661" height="398" /></p>
<p>Indeed, every group has gotten its own worksheet.  However, they’ve also gotten the very original names such as Sheet1, Sheet2 and so on.</p>
<h3>Customizing The Names Of The Sheets</h3>
<p>On to the final part of the requirements: giving our own customized name to the generated Excel sheets.  This is actually really easy once you know how to do this.</p>
<p>First select the ProductCategoryName group in the Row Groups pane so that its properties are displayed in the Properties pane.  In the Properties pane, locate the Group &gt; PageName property and specify the following expression:</p>
<pre class="code">=Fields!ProductCategoryName.Value</pre>
<p>That’s it, that’s all you need to do!  Don’t believe me?  Here’s what the export to Excel now looks like:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image386.png"><img style="display: inline; border-width: 0px;" title="Data exported to Excel, with customized sheetnames" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb89.png" border="0" alt="Data exported to Excel, with customized sheetnames" width="700" height="347" /></a></p>
<h2>Conclusion</h2>
<p>As we’ve seen in this article, it really doesn’t take too much effort to implement a custom name for the worksheets when exporting a report to Excel.  Neat feature!</p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><strong>References</strong></p>
<p><a title="Understanding Pagination in Reporting Services (Report Builder 3.0 and SSRS)" href="http://msdn.microsoft.com/en-us/library/dd255278.aspx" target="_blank">Understanding Pagination in Reporting Services (Report Builder 3.0 and SSRS)</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2011%2F03%2F23%2Fwhere-the-sheets-have-a-name-ssrs-excel-export%2F&amp;title=Where%20The%20Sheets%20Have%20A%20Name" id="wpa2a_4"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2011/03/23/where-the-sheets-have-a-name-ssrs-excel-export/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Cascading Calculated Fields (SSRS)</title>
		<link>http://blog.hoegaerden.be/2011/03/07/cascading-calculated-fields-ssrs/</link>
		<comments>http://blog.hoegaerden.be/2011/03/07/cascading-calculated-fields-ssrs/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 18:21:07 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[SSRS]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2011/03/07/cascading-calculated-fields-ssrs/</guid>
		<description><![CDATA[When thinking about Reporting Services in combination with the word cascading, the first that jumps to mind is cascading parameters.  We all know that one parameter can have its list of values filtered by what’s selected in another parameter. But what about calculated fields?  Are those cascading as well?  Can we refer to a calculated [...]]]></description>
			<content:encoded><![CDATA[<p>When thinking about Reporting Services in combination with the word cascading, the first that jumps to mind is cascading parameters.  We all know that one parameter can have its list of values filtered by what’s selected in another parameter.</p>
<p>But what about calculated fields?  Are those cascading as well?  Can we refer to a calculated field in the definition of another calculated field?  Let’s find out!</p>
<p>For the example I’ll be using the ContosoDW sample data warehouse running on SQL Server 2008 R2, more precisely:</p>
<blockquote><p>Microsoft SQL Server 2008 R2 (RTM) &#8211; 10.50.1600.1 (X64)   Apr  2 2010 15:48:46   Copyright (c) Microsoft Corporation  Enterprise Edition (64-bit) on Windows NT 6.1 &lt;X64&gt; (Build 7600: )</p></blockquote>
<p>The result can be <a title="CascadingCalculatedFields.rdl" href="http://cid-81c8b064cbbe1698.office.live.com/self.aspx/.Public/blog/CascadingCalculatedFields.rdl" target="_blank">downloaded from my Skydrive through this link</a>.</p>
<h2>The Example</h2>
<h3>Scenario</h3>
<p>We’ve been asked to build a report that produces a product catalogue.  The report only has one requirement: as our company is well-known for its branding, each product category has got its own color and this color should be used as background color in the report.</p>
<h3>Report</h3>
<p>Let’s first get some data.  Here’s a fairly simple query that retrieves all products with their related category and subcategory from the ContosoDW database:</p>
<pre class="code"><span style="color: blue;">select </span>DPC<span style="color: gray;">.</span>ProductCategoryName<span style="color: gray;">, </span>DPS<span style="color: gray;">.</span>ProductSubcategoryName<span style="color: gray;">, </span>DP<span style="color: gray;">.</span>ProductName
<span style="color: blue;">from </span>dbo<span style="color: gray;">.</span>DimProduct DP
<span style="color: gray;">inner join </span>dbo<span style="color: gray;">.</span>DimProductSubcategory DPS
    <span style="color: blue;">on </span>DPS<span style="color: gray;">.</span>ProductSubcategoryKey <span style="color: gray;">= </span>DP<span style="color: gray;">.</span>ProductSubcategoryKey
<span style="color: gray;">inner join </span>dbo<span style="color: gray;">.</span>DimProductCategory DPC
    <span style="color: blue;">on </span>DPC<span style="color: gray;">.</span>ProductCategoryKey <span style="color: gray;">= </span>DPS<span style="color: gray;">.</span>ProductCategoryKey<span style="color: gray;">;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>After building a dataset in a new report I end up with this:</p>
<p><img style="display: inline; border-width: 0px;" title="The Report Data pane before adding any calculated fields" src="http://blog.hoegaerden.be/wp-content/uploads/image374.png" border="0" alt="The Report Data pane before adding any calculated fields" width="245" height="233" /></p>
<h4>Calculated Field Number One</h4>
<p>Because this post is about calculated fields, we’re now going to apply a little dirty trick of hard-coding the category names and their corresponding color into a calculated field.  I do not recommend this for professional reports where the colors should be coming from the database so that your reports are not impacted when extra categories are added or when the marketing department decides to change their vision.</p>
<p>But for this example it’s perfect so let’s create a calculated field in the dataset.  That can be done by right-clicking the dataset and then selecting <strong>Add Calculated Field…</strong></p>
<p><img style="display: inline; border-width: 0px;" title="Right-click the dataset to add a calculated field" src="http://blog.hoegaerden.be/wp-content/uploads/image375.png" border="0" alt="Right-click the dataset to add a calculated field" width="325" height="170" /></p>
<p>Give the field a clear name, such as ProductCategoryColor, and click the fx button to enter the following expression:</p>
<pre class="code">=Switch(
    Fields!ProductCategoryName.Value = <span style="color: #a31515;">"Audio"</span>, <span style="color: #a31515;">"#FFD800"</span>,
    Fields!ProductCategoryName.Value = <span style="color: #a31515;">"Cameras and camcorders "</span>, <span style="color: #a31515;">"#FF0000"</span>,
    Fields!ProductCategoryName.Value = <span style="color: #a31515;">"Cell phones"</span>, <span style="color: #a31515;">"#00FF00"</span>,
    Fields!ProductCategoryName.Value = <span style="color: #a31515;">"Computers"</span>, <span style="color: #a31515;">"#0000FF"</span>,
    Fields!ProductCategoryName.Value = <span style="color: #a31515;">"Games and Toys"</span>, <span style="color: #a31515;">"#FF00FF"</span>,
    Fields!ProductCategoryName.Value = <span style="color: #a31515;">"Home Appliances"</span>, <span style="color: #a31515;">"#FFFF00"</span>,
    Fields!ProductCategoryName.Value = <span style="color: #a31515;">"Music, Movies and Audio Books"</span>, <span style="color: #a31515;">"#00FFFF"</span>,
    Fields!ProductCategoryName.Value = <span style="color: #a31515;">"TV and Video"</span>, <span style="color: #a31515;">"#ABCD12"
</span>)</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><em>Funny side note: do you notice that trailing space in the “Cameras and Camcorders” category?  It’s intentional!  Apparently that record has got a trailing space stored in the ProductCategoryName field in DimProductCategory.</em></p>
<p>With the first calculated field created, add a table to your report to display the products.  Set the <strong>BackgroundColor </strong>property of the whole Details row to the newly-created calculated field.</p>
<p>So far so good, here’s what the rendered report currently looks like:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image376.png"><img style="display: inline; border-width: 0px;" title="Rendered report with background color" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb87.png" border="0" alt="Rendered report with background color" width="700" height="195" /></a></p>
<h4>Calculated Field Number Two</h4>
<p>According to the business requirements we’re done creating the report.  However, it’s Friday early afternoon and we feel like having some fun.  And this post is about “cascading” calculated fields, so we need at least two of them.  Let’s create an Easter egg!</p>
<p>The “fun” requirement is the following: if the product’s name starts with an A then the text color for that record should be the same as the background color, but with the Blue component set to FF.  For example, if the background color is #00FF00 (green) then the text color should become #00FFFF (cyan).</p>
<p>Let’s create another calculated field in our dataset, called EasterEgg (don’t make it too hard for your colleagues to fix the weirdly behaving report).  Give it the following expression:</p>
<pre class="code">=IIF(Left(Fields!ProductName.Value, 1) = <span style="color: #a31515;">"A"</span>,
    Left(Fields!ProductCategoryColor.Value, 5) + <span style="color: #a31515;">"FF"</span>,
    <span style="color: #a31515;">"Black"</span>)</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>As you can see, we’re referring to the ProductCategoryColor field, the calculated field created earlier.</p>
<p>Now set the <strong>Color</strong> property of the Details row to this new calculated field and Preview the report.</p>
<p>Guess what?</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image377.png"><img style="display: inline; border-width: 0px;" title="Rendered report with cascading calculated field" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb88.png" border="0" alt="Rendered report with cascading calculated field" width="700" height="199" /></a></p>
<p>It works!</p>
<h2>Conclusion</h2>
<p>If you’re in a situation where you’d like to add calculated fields to an existing dataset and one of those fields should use the value of another calculated field, you can do it!  Cascading calculated fields are working fine in Reporting Services.</p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2011%2F03%2F07%2Fcascading-calculated-fields-ssrs%2F&amp;title=Cascading%20Calculated%20Fields%20%28SSRS%29" id="wpa2a_6"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2011/03/07/cascading-calculated-fields-ssrs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hide/Show Items Dependant On Export Format (SSRS)</title>
		<link>http://blog.hoegaerden.be/2011/01/18/ssrs-hideshow-items-dependant-on-export-format/</link>
		<comments>http://blog.hoegaerden.be/2011/01/18/ssrs-hideshow-items-dependant-on-export-format/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 18:00:02 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SSRS]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2011/01/18/ssrs-hideshow-items-dependant-on-export-format/</guid>
		<description><![CDATA[Now and then I encounter forum questions in the style of the following: I have a report with a title.  When rendered through the Report Manager and when exported to PDF, I want it to render as normal.  However, when exported to Excel I do not want to get the title.  How can I hide [...]]]></description>
			<content:encoded><![CDATA[<p>Now and then I encounter forum questions in the style of the following:</p>
<blockquote><p>I have a report with a title.  When rendered through the Report Manager and when exported to PDF, I want it to render as normal.  However, when exported to Excel I do not want to get the title.  How can I hide it?</p></blockquote>
<p>Because I don’t like re-inventing the wheel each time I decided to write a blog post about it.</p>
<p>As of SQL Server 2008 R2, we’ve got a built-in global field that can help us out.  This field is called <strong>Globals!RenderFormat</strong>.  It has two properties: <strong>Name</strong> and <strong>IsInteractive</strong>.  Name represents the unique name that indicates the chosen renderer, and IsInteractive indicates whether or not the chosen report format is, well, interactive.</p>
<p>Depending on the renderer, the values of the properties differ.  To be able to use the variable in an expression, we need to know its values for each rendering format.  Here’s the list of different possibilities:</p>
<table border="1" cellspacing="0" cellpadding="2" width="682">
<tbody>
<tr>
<td width="363" valign="top"><strong>Renderer</strong></td>
<td width="133" valign="top"><strong>RenderFormat.Name</strong></td>
<td width="184" valign="top"><strong>RenderFormat.IsInteractive</strong></td>
</tr>
<tr>
<td width="363" valign="top">Preview in BIDS or rendered through Report Manager</td>
<td width="133" valign="top">RPL</td>
<td width="184" valign="top">True</td>
</tr>
<tr>
<td width="363" valign="top">XML file with report data</td>
<td width="133" valign="top">XML</td>
<td width="184" valign="top">False</td>
</tr>
<tr>
<td width="363" valign="top">CSV (comma delimited)</td>
<td width="133" valign="top">CSV</td>
<td width="184" valign="top">False</td>
</tr>
<tr>
<td width="363" valign="top">TIFF file or Print button</td>
<td width="133" valign="top">IMAGE</td>
<td width="184" valign="top">False</td>
</tr>
<tr>
<td width="363" valign="top">PDF</td>
<td width="133" valign="top">PDF</td>
<td width="184" valign="top">False</td>
</tr>
<tr>
<td width="363" valign="top">MHTML (web archive)</td>
<td width="133" valign="top">MHTML</td>
<td width="184" valign="top">True</td>
</tr>
<tr>
<td width="363" valign="top">Excel</td>
<td width="133" valign="top">EXCEL</td>
<td width="184" valign="top">False</td>
</tr>
<tr>
<td width="363" valign="top">Word</td>
<td width="133" valign="top">WORD</td>
<td width="184" valign="top">False</td>
</tr>
</tbody>
</table>
<p>If these names for RenderFormat look familiar to you, you’re probably right.  Have a look at the <em>rsreportserver.config</em> file in the <em>C:\Program Files\Microsoft SQL Server\MSRS10_50.SQL2008R2\Reporting Services\ReportServer</em> folder.  Note that you may need to adapt the folder to your specific settings.  In my case my instance is called “SQL2008R2”.  Near the bottom of that configuration file you can find the <em>&lt;Render&gt; </em>node, located under <em>&lt;Extensions&gt;</em>.  The names that you see there are those used by the RenderFormat.Name property.</p>
<p>Now that we know what values to test on, let’s get started.</p>
<p>If we get back to the example of hiding a title, or textbox, when exporting to Excel, here’s what needs to happen.  Locate the <strong>Hidden</strong> property of the textbox that you want to hide, and give it the following expression:</p>
<pre class="code">=IIF(Globals!RenderFormat.Name = <span style="color: #a31515;">"EXCEL"</span>, <span style="color: blue;">True</span>, <span style="color: blue;">False</span>)</pre>
<p><a href="http://11011.net/software/vspaste"></a>What we’re saying here is: if the RenderFormat is EXCEL, then the Hidden property should be set to True.  Which results in a hidden textbox whenever the report is exported to Excel!</p>
<p><em>As Erik pointed out in the comments, in this particular case you don&#8217;t need the IIF() statement.  The result of the expression results in True when the expected value should be True, and False when False is expected.</em></p>
<p>As a quick note: when building your expression through the expression builder, you’ll notice that the Intellisense doesn’t know the new RenderFormat field yet.  Do not worry about that, just continue typing and ignore any errors being indicated.  If you use the syntax as I highlighted above, it will work!  Well, unless you’re running an earlier version than SQL Server 2008 R2 of course.  In that case it won’t work.</p>
<p><img style="display: inline; border: 0px;" title="Intellisense doesn't know RenderFormat yet" src="http://blog.hoegaerden.be/wp-content/uploads/image366.png" border="0" alt="Intellisense doesn't know RenderFormat yet" width="265" height="211" /></p>
<p>In contradiction to the Intellisense, the bottom part of the expression builder screen has been updated to show the new properties.  So if you don’t remember the syntax, you can just locate the field in the <em>Built-in Fields</em> category and give it a good double-click.</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image367.png"><img style="display: inline; border: 0px;" title="RenderFormat is located in the Built-in Fields category" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb83.png" border="0" alt="RenderFormat is located in the Built-in Fields category" width="700" height="193" /></a></p>
<p>Of course, the Excel example in this post is just one of many possibilities that this new field offers.  Is your company environment-friendly and does it want to prevent wasting paper?  Now it’s possible, just hide that 50-pages long table when the report is being rendered for print!</p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><strong>References</strong></p>
<p><a title="Globals!RenderFormat aka Renderer Dependent Report Layout" href="http://blogs.msdn.com/b/robertbruckner/archive/2010/05/02/globals-renderformat-aka-renderer-dependent-report-layout.aspx" target="_blank">Globals!RenderFormat aka Renderer Dependent Report Layout by Robert Bruckner</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2011%2F01%2F18%2Fssrs-hideshow-items-dependant-on-export-format%2F&amp;title=Hide%2FShow%20Items%20Dependant%20On%20Export%20Format%20%28SSRS%29" id="wpa2a_8"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2011/01/18/ssrs-hideshow-items-dependant-on-export-format/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Put Some Images On Those SSRS Reports</title>
		<link>http://blog.hoegaerden.be/2010/07/07/put-some-images-on-those-ssrs-reports/</link>
		<comments>http://blog.hoegaerden.be/2010/07/07/put-some-images-on-those-ssrs-reports/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 16:05:21 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[Reporting Services 2008]]></category>
		<category><![CDATA[SSRS]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/07/07/put-some-images-on-those-ssrs-reports/</guid>
		<description><![CDATA[On the forums I now and then encounter questions regarding images on SSRS reports.  Instead of re-inventing the wheel each time, I decided to write an article about the subject.  So in this article I’ll be discussing and demonstrating several different ways of how images can be put on a report. I’m using SQL Server [...]]]></description>
			<content:encoded><![CDATA[<p>On the forums I now and then encounter questions regarding images on SSRS reports.  Instead of re-inventing the wheel each time, I decided to write an article about the subject.  So in this article I’ll be discussing and demonstrating several different ways of how images can be put on a report.</p>
<p>I’m using SQL Server Reporting Services 2008 R2 CTP, more precisely version 10.50.1352.12, but the methods explained here will work on any SSRS 2008.  Furthermore I’m using the AdventureWorks2008R2 database, <a title="AdventureWorks 2008R2 RTM" href="http://msftdbprodsamples.codeplex.com/releases/view/45907" target="_blank">available at CodePlex</a>.</p>
<p>The resulting report, including image files, <a title="SSRS and images download" href="http://cid-81c8b064cbbe1698.office.live.com/self.aspx/.Public/blog/SSRS%5E_and%5E_images.zip" target="_blank">can be downloaded from my Skydrive</a>.</p>
<h2>The Scenario</h2>
<p>The marketing department has requested a product catalogue.  This catalogue should contain all products produced by our two daughter companies: The Canyon Peak and Great Falls Soft.  The catalogue should be grouped on company, with the next company&#8217;s products starting on a new page.</p>
<p>Further requirements are:</p>
<ol>
<li>
<ol>
<li>Each page needs an image in its header, with even pages displaying a different image than odd pages.</li>
<li>Each company has a logo.  The logo should be displayed in the company’s header.</li>
<li>Each product has a logo.  The logo should be displayed as part of the product details.</li>
</ol>
</li>
</ol>
<p>A design document containing the expected layout, including all image material, has been provided.</p>
<h2>The Data</h2>
<p>The following query provides us with all the data needed to produce the report:</p>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<pre class="code"><span style="color: blue;">SELECT </span><span style="color: red;">'The Canyon Peak' </span><span style="color: blue;">as </span>Company<span style="color: gray;">, </span><span style="color: red;">'TheCanyonPeak_logo.png' </span>CompanyLogo<span style="color: gray;">,
    </span><span style="color: red;">'The Canyon Peak company specializes in all kinds of bikes, such as touring and road bikes.' </span>CompanyDescription<span style="color: gray;">,
    </span>P<span style="color: gray;">.</span>Name <span style="color: blue;">as </span>Product<span style="color: gray;">, </span>PS<span style="color: gray;">.</span>Name <span style="color: blue;">as </span>Subcategory<span style="color: gray;">, </span>PC<span style="color: gray;">.</span>Name <span style="color: blue;">as </span>Category<span style="color: gray;">,
    </span>PP<span style="color: gray;">.</span>LargePhoto<span style="color: gray;">, </span>P<span style="color: gray;">.</span>ListPrice<span style="color: gray;">, </span>P<span style="color: gray;">.</span><span style="color: blue;">Weight</span><span style="color: gray;">, </span>P<span style="color: gray;">.</span>Size<span style="color: gray;">,
    </span>P<span style="color: gray;">.</span>SizeUnitMeasureCode<span style="color: gray;">, </span>P<span style="color: gray;">.</span>WeightUnitMeasureCode
<span style="color: blue;">FROM </span>Production<span style="color: gray;">.</span>Product <span style="color: blue;">AS </span>P
    <span style="color: gray;">INNER JOIN </span>Production<span style="color: gray;">.</span>ProductSubcategory <span style="color: blue;">AS </span>PS
        <span style="color: blue;">ON </span>PS<span style="color: gray;">.</span>ProductSubcategoryID <span style="color: gray;">= </span>P<span style="color: gray;">.</span>ProductSubcategoryID
    <span style="color: gray;">INNER JOIN </span>Production<span style="color: gray;">.</span>ProductCategory <span style="color: blue;">AS </span>PC
        <span style="color: blue;">ON </span>PC<span style="color: gray;">.</span>ProductCategoryID <span style="color: gray;">= </span>PS<span style="color: gray;">.</span>ProductCategoryID
    <span style="color: gray;">LEFT OUTER JOIN </span>Production<span style="color: gray;">.</span>ProductProductPhoto PPP
        <span style="color: blue;">ON </span>PPP<span style="color: gray;">.</span>ProductID <span style="color: gray;">= </span>P<span style="color: gray;">.</span>ProductID
    <span style="color: gray;">LEFT OUTER JOIN </span>Production<span style="color: gray;">.</span>ProductPhoto PP
        <span style="color: blue;">ON </span>PPP<span style="color: gray;">.</span>ProductPhotoID <span style="color: gray;">= </span>PP<span style="color: gray;">.</span>ProductPhotoID
<span style="color: blue;">WHERE </span>PC<span style="color: gray;">.</span>Name <span style="color: gray;">= </span><span style="color: red;">'Bikes' </span><span style="color: green;">--The Canyon Peak sells bikes
    </span><span style="color: gray;">and </span>PP<span style="color: gray;">.</span>ProductPhotoID <span style="color: gray;">&gt; </span>1 <span style="color: green;">--I don't want NO IMAGE AVAILABLE
</span><span style="color: blue;">UNION </span><span style="color: gray;">ALL
</span><span style="color: blue;">SELECT </span><span style="color: red;">'Great Falls Soft' </span><span style="color: blue;">as </span>Company<span style="color: gray;">, </span><span style="color: red;">'GreatFallsSoft_logo.png' </span>CompanyLogo<span style="color: gray;">,
    </span><span style="color: red;">'Great Falls Soft uses only the softest tissues available for those sporting clothes.  And on top of that, they''re waterproof.' </span>CompanyDescription<span style="color: gray;">,
    </span>P<span style="color: gray;">.</span>Name <span style="color: blue;">as </span>Product<span style="color: gray;">, </span>PS<span style="color: gray;">.</span>Name <span style="color: blue;">as </span>Subcategory<span style="color: gray;">, </span>PC<span style="color: gray;">.</span>Name <span style="color: blue;">as </span>Category<span style="color: gray;">,
    </span>PP<span style="color: gray;">.</span>LargePhoto<span style="color: gray;">, </span>P<span style="color: gray;">.</span>ListPrice<span style="color: gray;">, </span>P<span style="color: gray;">.</span><span style="color: blue;">Weight</span><span style="color: gray;">, </span>P<span style="color: gray;">.</span>Size<span style="color: gray;">,
    </span>P<span style="color: gray;">.</span>SizeUnitMeasureCode<span style="color: gray;">, </span>P<span style="color: gray;">.</span>WeightUnitMeasureCode
<span style="color: blue;">FROM </span>Production<span style="color: gray;">.</span>Product <span style="color: blue;">AS </span>P
    <span style="color: gray;">INNER JOIN </span>Production<span style="color: gray;">.</span>ProductSubcategory <span style="color: blue;">AS </span>PS
        <span style="color: blue;">ON </span>PS<span style="color: gray;">.</span>ProductSubcategoryID <span style="color: gray;">= </span>P<span style="color: gray;">.</span>ProductSubcategoryID
    <span style="color: gray;">INNER JOIN </span>Production<span style="color: gray;">.</span>ProductCategory <span style="color: blue;">AS </span>PC
        <span style="color: blue;">ON </span>PC<span style="color: gray;">.</span>ProductCategoryID <span style="color: gray;">= </span>PS<span style="color: gray;">.</span>ProductCategoryID
    <span style="color: gray;">LEFT OUTER JOIN </span>Production<span style="color: gray;">.</span>ProductProductPhoto PPP
        <span style="color: blue;">ON </span>PPP<span style="color: gray;">.</span>ProductID <span style="color: gray;">= </span>P<span style="color: gray;">.</span>ProductID
    <span style="color: gray;">LEFT OUTER JOIN </span>Production<span style="color: gray;">.</span>ProductPhoto PP
        <span style="color: blue;">ON </span>PPP<span style="color: gray;">.</span>ProductPhotoID <span style="color: gray;">= </span>PP<span style="color: gray;">.</span>ProductPhotoID
<span style="color: blue;">WHERE </span>PC<span style="color: gray;">.</span>Name <span style="color: gray;">= </span><span style="color: red;">'Clothing' </span><span style="color: green;">--Great Falls Soft sells clothes, waterstopping soft clothes
    </span><span style="color: gray;">and </span>PP<span style="color: gray;">.</span>ProductPhotoID <span style="color: gray;">&gt; </span>1 <span style="color: green;">--I don't want NO IMAGE AVAILABLE
</span><span style="color: blue;">ORDER BY </span>Category <span style="color: blue;">asc</span><span style="color: gray;">, </span>Subcategory <span style="color: blue;">asc</span><span style="color: gray;">, </span>Product <span style="color: blue;">asc</span><span style="color: gray;">;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>I’m not going into the details of this query.  Let’s just say that I’m manipulating data from the database in combination with some hardcoded data to get usable data for our example.  I’ve added some comments to make it clear what the query is doing.  If you have a look at its output, you’ll see that it produces a list of products with some additional fields.</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image303.png"><img style="display: inline; border-width: 0px;" title="Results of the query" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb71.png" border="0" alt="Results of the query" width="700" height="72" /></a></p>
<h2>Different Ways Of Adding Images</h2>
<p>To get started, open up a SSRS solution, add a new report, add a data source connecting to your AdventureWorks 2008 R2 DB, and add a dataset using the above query.</p>
<h3>Embedding Images In Your Report</h3>
<p>The first way of adding images to a report that we’ll take a look at is by embedding them inside the report.  Looking at the scenario requirements described earlier, this is requirement 1.</p>
<p>Let’s add a header to the report.  In the BIDS menu, select <strong>Report</strong> &gt; <strong>Add Page Header</strong>.</p>
<p><img style="display: inline; border-width: 0px;" title="Adding a header to a report" src="http://blog.hoegaerden.be/wp-content/uploads/image304.png" border="0" alt="Adding a header to a report" width="265" height="178" /></p>
<p>If you don’t see the Report menu item, you probably have not selected your report.  Click your report in the Design view to select it.</p>
<p>From the Toolbox, drag the Image report item onto the header portion of the report.  Doing that will show a pop-up window, the Image Properties.  By default, the <strong>Select the image source </strong>combobox is set to <em>Embedded</em>.  Good, that’s what we need at this point.  What we now need to do is import an image into the report, using the <strong>Import</strong> button.</p>
<p>Clicking the Import button shows a common file Open dialog.  Our marketing department has given me two images for use in the header: Cloudy_banner.png and AnotherCloudy_banner.png.  Let’s select the first one.</p>
<p><img style="display: inline; border-width: 0px;" title="Adding an image to a report by using the Import button on the Image Properties window" src="http://blog.hoegaerden.be/wp-content/uploads/image305.png" border="0" alt="Adding an image to a report by using the Import button on the Image Properties window" width="625" height="434" /></p>
<p>If you don’t see any images, have a look at that filter dropdown as highlighted in the screenshot above.  By default this is set to JPEG files.</p>
<p>Here’s the result in the Image Properties:</p>
<p><img style="display: inline; border-width: 0px;" title="Image Properties with an image selected" src="http://blog.hoegaerden.be/wp-content/uploads/image306.png" border="0" alt="Image Properties with an image selected" width="585" height="532" /></p>
<p>On the Size page, select <em>Clip</em> instead of <em>Fit proportional</em>.  This is a setting that you’ll need to look at case per case.  For our header images, <em>Clip</em> is the most suitable option.</p>
<p><img style="display: inline; border-width: 0px;" title="Image Properties: set Display to Clip" src="http://blog.hoegaerden.be/wp-content/uploads/image307.png" border="0" alt="Image Properties: set Display to Clip" width="585" height="532" /></p>
<p>Close the Image Properties window and enlarge the image placeholder so that it occupies the whole header area:</p>
<p><img style="display: inline; border-width: 0px;" title="Image added to report header" src="http://blog.hoegaerden.be/wp-content/uploads/image308.png" border="0" alt="Image added to report header" width="544" height="180" /></p>
<p>As you can see, we now have an image in the header.  But we haven’t fully implemented the requirement yet.  The even pages should display a different image than the uneven ones.</p>
<p>To be able to do that, we’ll first add the second banner image to the report.  In the Report Data pane, locate the <em>Images</em> node and open it up.  You’ll notice that the image that we inserted earlier can be found here.</p>
<p><img style="display: inline; border-width: 0px;" title="The Images node in the Report Data pane shows all embedded images" src="http://blog.hoegaerden.be/wp-content/uploads/image309.png" border="0" alt="The Images node in the Report Data pane shows all embedded images" width="168" height="159" /></p>
<p>Right-click the <em>Images</em> node and select <strong>Add Image</strong>.</p>
<p><img style="display: inline; border-width: 0px;" title="Right-click Images node to add an embedded image to the report" src="http://blog.hoegaerden.be/wp-content/uploads/image310.png" border="0" alt="Right-click Images node to add an embedded image to the report" width="229" height="155" /></p>
<p>That opens up the familiar file Open dialog which was used to add the first image.  So I’m now selecting the file called AnotherCloudy_banner.png, after changing the default filter to PNG.  After clicking OK, the image gets added under the Images node.</p>
<p><img style="display: inline; border-width: 0px;" title="Second banner image added to the report" src="http://blog.hoegaerden.be/wp-content/uploads/image311.png" border="0" alt="Second banner image added to the report" width="190" height="64" /></p>
<p>With the second image added, all that remains to be done is tell the header that it should pick different images depending on the page number.</p>
<p>Right-click the image in the header and select <strong>Image Properties</strong>.  On the General page, when you click the dropdown of the setting called Use this image, you’ll notice that there are two values now.  These are the same values as displayed in the Report Data pane.  And these are the values to be used in the expression that we’ll create to rotate the images depending on page number.</p>
<p>Click the fx button next to the dropdown and enter the following expression:</p>
<pre class="code">=IIF(Globals!PageNumber <span style="color: blue;">Mod </span>2 = 0, <span style="color: #a31515;">"Cloudy_banner"</span>, <span style="color: #a31515;">"AnotherCloudy_banner"</span>)</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>This is a fairly simple expression, using the Mod operator and the IIF() function.  When page number can be divided by two, which means it’s an even page number, Cloudy_banner is displayed.  Otherwise the other banner is displayed.</p>
<p>That’s it, the report header is finished.  When you have a look at the report in Preview, it should now show the second banner on the first page – this is an uneven page.</p>
<p>To conclude this chapter I’d like to mention that this method is usually not the preferred one.  A <strong>disadvantage</strong> here is that the images are stored inside the report RDL and thus cannot be modified without altering the report itself.</p>
<p>Here’s the evidence:</p>
<pre class="code"> <span style="color: blue;">&lt;</span><span style="color: #a31515;">EmbeddedImages</span><span style="color: blue;">&gt;
    &lt;</span><span style="color: #a31515;">EmbeddedImage </span><span style="color: red;">Name</span><span style="color: blue;">=</span>"<span style="color: blue;">Cloudy_banner</span>"<span style="color: blue;">&gt;
      &lt;</span><span style="color: #a31515;">MIMEType</span><span style="color: blue;">&gt;</span>image/png<span style="color: blue;">&lt;/</span><span style="color: #a31515;">MIMEType</span><span style="color: blue;">&gt;
      &lt;</span><span style="color: #a31515;">ImageData</span><span style="color: blue;">&gt;</span>iVBORw0KGgoAAAANSUhEUgAABVsAAABaCAIAAA...</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>To have a look at the RDL yourself, just right-click the report in the <strong>Solution Explorer</strong> and select <em>View Code</em>.</p>
<p>On to requirement number two!</p>
<h3>Displaying Images Through A URL</h3>
<p>At the moment, the report body is still empty, so drag a Table onto it.  Put the Table in the upper-left corner, remove one of the columns so that two remain, remove the Header row and make it a bit wider.</p>
<p>Now set the <strong>DataSetName</strong> property of the Tablix to the name of your dataset, in my case that’s <em>dsProducts</em>.</p>
<p>The report should display the data grouped on company, so right-click on the line that says <em>Details</em> in the Row Groups window part at the bottom of the Design View.  Select <strong>Add Group &gt; Parent Group</strong>.</p>
<p><img style="display: inline; border-width: 0px;" title="Right-click the Details line in Row Groups to add a new parent group" src="http://blog.hoegaerden.be/wp-content/uploads/image312.png" border="0" alt="Right-click the Details line in Row Groups to add a new parent group" width="646" height="160" /></p>
<p>Group by Company and add a group header:</p>
<p><img style="display: inline; border-width: 0px;" title="Tablix grouping" src="http://blog.hoegaerden.be/wp-content/uploads/image313.png" border="0" alt="Tablix grouping" width="451" height="201" /></p>
<p>Remove the extra first column that just got generated:</p>
<p><img style="display: inline; border-width: 0px;" title="Remove unwanted column" src="http://blog.hoegaerden.be/wp-content/uploads/image314.png" border="0" alt="Remove unwanted column" width="646" height="189" /></p>
<p>We’ve now got an empty tablix with two columns, a Details row and a Company header row.  In our dataset, one of the fields is called <em>CompanyDescription</em>.  Hover the mouse pointer above the textbox in the top-right, click the small icon that appears and choose the field from the dropdown that appears when you click the icon.</p>
<p><img style="display: inline; border-width: 0px;" title="Click the small icon to get a list of fields" src="http://blog.hoegaerden.be/wp-content/uploads/image315.png" border="0" alt="Click the small icon to get a list of fields" width="299" height="64" /></p>
<p>To add the company’s logo, drag an Image from the Toolbox pane into the textbox on the left of the company description.  Doing this opens up the by now familiar Image Properties dialog.</p>
<p>Give it a good name, such as CompanyLogo, and select <em>External</em> as image source.</p>
<p>Click the fx button next to the <strong>Use this image</strong> box and enter an expression such as this one:</p>
<pre class="code">=<span style="color: #a31515;">"file:C:\vavr\test\" </span>+ Fields!CompanyLogo.Value</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>When using External as image source, the image expression should result in a valid URL, any valid URL.  In my example the files are located in a local folder called c:\vavr\test.  Keep in mind that, when you deploy the report to a server, the images should by located in that same folder, this time located on the server.</p>
<p><img style="display: inline; border-width: 0px;" title="The Image Properties configured to display an External image" src="http://blog.hoegaerden.be/wp-content/uploads/image316.png" border="0" alt="The Image Properties configured to display an External image" width="417" height="200" /></p>
<p>By default the image gets displayed using the <em>Fit Proportional </em>setting.  You can verify this in the <strong>Size</strong> page of the Image Properties.  We want the image to get fully displayed while maintaining the aspect ratio, so leave the setting as it is.  Close the image properties dialog.</p>
<p>Vertically enlarge the first row in our tablix to an acceptable size.  In my case the marketing department specified to use a height of 1.5 inches for the company logo.  With the image selected, locate the Size &gt; Height property and set it to “1,5in”.  Note that the decimal separator used here depends on your local settings.</p>
<p>Now have a look at the report in Preview:</p>
<p><img style="display: inline; border-width: 0px;" title="The report with company logos added" src="http://blog.hoegaerden.be/wp-content/uploads/image317.png" border="0" alt="The report with company logos added" width="664" height="328" /></p>
<p>Note that I’ve removed the borders of all textboxes by setting their <strong>BorderStyle </strong>property to <em>None</em>.</p>
<p>With the logo images implemented we have fulfilled requirement two.  On to number three.</p>
<h3>Retrieving Images From The Database</h3>
<p>In this last requirement we’ll have a look at displaying images that are retrieved from the database, also known as data-bound images.</p>
<p>The retrieving part is actually already implemented.  In our dataset there’s a field called <strong>LargePhoto</strong>, that one contains a picture of the product.</p>
<p>Let’s add some product details and a picture in that remaining blank row.  To get full control over layout I want to make the detail part of the tablix a freestyle part.  First merge the two cells together by selecting both of them, then right-click and choose <strong>Merge Cells</strong>.</p>
<p><img style="display: inline; border-width: 0px;" title="Merging two cells together in a tablix" src="http://blog.hoegaerden.be/wp-content/uploads/image318.png" border="0" alt="Merging two cells together in a tablix" width="686" height="632" /></p>
<p>Now select a <strong>Rectangle</strong> in the Toolbox pane and drop it into the merged area.  To add fields such as Subcategory and Product you can just select them from the <strong>Report Data </strong>pane and drop them inside the rectangle.  I’m also adding some additional labels and fields, as shown in the next screenshot.</p>
<p><img style="display: inline; border-width: 0px;" title="The product details in Design view" src="http://blog.hoegaerden.be/wp-content/uploads/image319.png" border="0" alt="The product details in Design view" width="347" height="196" /></p>
<p>As you can see I’ve modified the fonts a bit.  The rendered version:</p>
<p><img style="display: inline; border-width: 0px;" title="The rendered product details" src="http://blog.hoegaerden.be/wp-content/uploads/image320.png" border="0" alt="The rendered product details" width="306" height="187" /></p>
<p>This is the expression used for displaying the weight:</p>
<pre class="code">=IIF(
    IsNothing(Fields!Weight.Value),
    <span style="color: #a31515;">"unknown"</span>,
    Fields!Weight.Value &amp; <span style="color: #a31515;">" " </span>&amp; Fields!WeightUnitMeasureCode.Value
)</pre>
<p><a href="http://11011.net/software/vspaste"></a>And here’s the expression for the size field:</p>
<pre class="code">=Fields!Size.Value &amp; <span style="color: #a31515;">" " </span>&amp; Fields!SizeUnitMeasureCode.Value</pre>
<p>For the layout of the price field I’ve just entered C in the <strong>Format</strong> property of the textbox.</p>
<p>With the textual product details completed, all that remains to be done is adding the product image.</p>
<p>From the Toolbox pane, drag an <strong>Image</strong> into the remaining whitespace in the rectangle, next to the product details.  (You did keep some space available, right?)</p>
<p>Again we get the familiar Image Properties popup.  Give it a good name, like ProductImage, and select the image source that we haven’t used yet, <em>Database</em>.  In the <strong>Use this field </strong>dropdown, select <em>LargePhoto</em>, and select <em>image/gif</em> as <strong>MIME type</strong>.</p>
<p><strong>Note:</strong> the images are stored as GIF.  You can verify this by running a select on the Production.ProductPhoto table.  Looking at the LargePhotoFileName field we see that the extension is .gif.</p>
<p>There one textbox on the General page that’s still blank.  That one is called Tooltip.  Click the fx button next to it and enter following formula:</p>
<pre class="code">=Fields!Product.Value</pre>
<p><a href="http://11011.net/software/vspaste"></a>Click sufficient OK buttons until the properties dialog is gone, then resize the image placeholder so that it occupies the remaining whitespace.</p>
<p>Here’s what the result looks like in preview:</p>
<p><img style="display: inline; border-width: 0px;" title="The final report, with a tooltip on the product image" src="http://blog.hoegaerden.be/wp-content/uploads/image321.png" border="0" alt="The final report, with a tooltip on the product image" width="656" height="344" /></p>
<p>When hovering the mouse pointer above the product image, you’ll get a nice tooltip.</p>
<h2>Conclusion</h2>
<p>In this article I have illustrated the three possible methods of adding an image to your Reporting Services report.</p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><strong>References</strong></p>
<p><a title="Adding Images to a Report" href="http://msdn.microsoft.com/en-us/library/ms156482.aspx" target="_blank">BOL: Adding Images to a Report</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2010%2F07%2F07%2Fput-some-images-on-those-ssrs-reports%2F&amp;title=Put%20Some%20Images%20On%20Those%20SSRS%20Reports" id="wpa2a_10"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2010/07/07/put-some-images-on-those-ssrs-reports/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Implementing Data Bars In A Grouped Table</title>
		<link>http://blog.hoegaerden.be/2010/05/27/implementing-data-bars-in-a-grouped-table/</link>
		<comments>http://blog.hoegaerden.be/2010/05/27/implementing-data-bars-in-a-grouped-table/#comments</comments>
		<pubDate>Thu, 27 May 2010 20:16:21 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[Reporting Services 2008 R2]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SSRS]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/05/27/implementing-data-bars-in-a-grouped-table/</guid>
		<description><![CDATA[Earlier I wrote an article about the new lookup functions that ship with SQL Server 2008 R2.&#160; Today I’m going to show you another new feature of SSRS 2008 R2, this time in the visualization department.&#160; This feature is the Data Bar.&#160; With this new component it’s fairly easy to make your tabular data a [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier I wrote an article about <a title="Looking Up Data On Different Sources" href="http://blog.hoegaerden.be/2010/05/16/looking-up-data-on-different-sources/">the new lookup functions</a> that ship with SQL Server 2008 R2.&#160; Today I’m going to show you another new feature of SSRS 2008 R2, this time in the visualization department.&#160; This feature is the <a title="BOL 2008R2: Sparklines and Data Bars" href="http://msdn.microsoft.com/en-us/library/ee636365%28v=SQL.105%29.aspx" target="_blank">Data Bar</a>.&#160; With this new component it’s fairly easy to make your tabular data a lot more visual, and thus easier to interpret.&#160; And here’s how to do it.</p>
<p>I’ll be starting from the report that I created in <a title="Your First OLAP Report" href="http://blog.hoegaerden.be/2010/01/24/your-first-olap-report/">Your First OLAP Report</a>.&#160; That allows me to focus on the visualization part, without first needing to build a table report.&#160; (Okay, I admit, it’s not 100% the same report – I’ve modified the colors a bit because I felt the green was too dark.) But obviously this method will work with any report that’s showing data in a table.</p>
<p>Furthermore I’m running SQL Server 2008 R2 Nov CTP, 64-bit, and I’m using the BIDS to develop the report.</p>
<p>The final result <a title="Download: &quot;First OLAP Report With Data Bars&quot;" href="http://cid-81c8b064cbbe1698.skydrive.live.com/self.aspx/.Public/blog/FirstOLAPReportWithDataBars.rdl" target="_blank">can be downloaded from Skydrive here</a>.</p>
<h2>Implementing The Data Bar</h2>
<p>The report that we’re using is showing some sales figures grouped in three levels: Country, State/Province and City.&#160; We’re going to add an extra column on the right of the table to contain the data bar.&#160; Let’s first explore the Toolbox pane to discover the new visualization report items.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="The new Reporting Services 2008 R2 report items: Map, Data Bar, Sparkline and Indicator" border="0" alt="The new Reporting Services 2008 R2 report items: Map, Data Bar, Sparkline and Indicator" src="http://blog.hoegaerden.be/wp-content/uploads/image262.png" width="120" height="342" /></p>
<p>The new items have been highlighted in yellow.&#160; As you can see, besides <strong>Data Bar </strong>there’s also <strong>Sparkline, </strong><strong>Map </strong>and <strong>Indicator</strong>.&#160; But those are not on topic now.</p>
<p>To add a Data Bar, simply drag it from the Toolbox into a textbox on the report.&#160; Doing that will show the following popup window:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Select Data Bar Type window" border="0" alt="Select Data Bar Type window" src="http://blog.hoegaerden.be/wp-content/uploads/image263.png" width="348" height="482" /></p>
<p>From left to right, there’s Bar, Stacked Bar and 100% Stacked Bar.&#160; And those are also available in vertical direction, Column.&#160; I’m going to use the regular Bar as highlighted in the screenshot.</p>
<p>The Data Bar has now been added to the report, but it doesn’t do anything yet.&#160; We first need to tell it what data to visualize.&#160; Clicking it once will select it, clicking it once more will show us the following <strong>Chart Data </strong>popup:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Data Bar: Chart Data" border="0" alt="Data Bar: Chart Data" src="http://blog.hoegaerden.be/wp-content/uploads/image264.png" width="612" height="434" /></p>
<p>Click the plus icon to get a drop-down of fields in the dataset.&#160; Select the numeric field that you want to visualize, in my case that’s the Reseller_Sales_Amount.</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image350.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Data Bar: Chart Data with Reseller_Sales_Amount selected" border="0" alt="Data Bar: Chart Data with Reseller_Sales_Amount selected" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb81.png" width="700" height="385" /></a>&#160;</p>
<p>By default, the aggregation used on the data is Sum.&#160; But there are other options as well, have a look at the dropdown next to the [Sum(Reseller_Sales…&#160; In the example here I’m going to keep the Sum.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Other aggregation functions of the Data Bar" border="0" alt="Other aggregation functions of the Data Bar" src="http://blog.hoegaerden.be/wp-content/uploads/image266.png" width="437" height="450" /></p>
<p>The report Preview looks like this:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image267.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Report preview with the data bar" border="0" alt="Report preview with the data bar" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb63.png" width="700" height="208" /></a></p>
<p>In this report we can easily see what states have got a higher sales amount: those with the longer bars.</p>
<p>Let’s add bars for the Country level as well.&#160; There are two ways to achieve that: you can either drag a new Data Bar onto the report or you can just copy/paste the textbox containing our first Data Bar.</p>
<p>To make the report easier to read I will change the color of the Data Bar to the color of the group’s background.&#160; Setting up the color of the Data Bar is done as follows: select the Data Bar so that you get the Chart Data popup.&#160; In the Properties pane you should see that the Chart Series is selected.&#160; Then right-click on the bar and select <strong>Series Properties</strong>.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="The right-click menu on the Data Bar." border="0" alt="The right-click menu on the Data Bar." src="http://blog.hoegaerden.be/wp-content/uploads/image268.png" width="434" height="445" /></p>
<p>In the <strong>Series Properties</strong> window, select the <strong>Fill</strong> page and select your favorite color.&#160; If you want you can also use a gradient fill or pattern.&#160; You can even use a Switch statement and color them differently depending on their value, similar to the method that I used in my <a title="SSRS and MDX: Detecting Missing Fields" href="http://blog.hoegaerden.be/2009/07/06/ssrs-and-mdx-detecting-missing-fields/">SSRS and MDX: Detecting Missing Fields</a> article.&#160; Well, in short, any expression that you can think of and results in a color will work fine!</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Series Properies: setting up the Fill color" border="0" alt="Series Properies: setting up the Fill color" src="http://blog.hoegaerden.be/wp-content/uploads/image269.png" width="585" height="520" /></p>
<p>With the second data bar and custom coloring set up, here’s the rendered report:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image270.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Report with data bar on two grouping levels" border="0" alt="Report with data bar on two grouping levels" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb64.png" width="700" height="237" /></a></p>
<p>Hang on, is that correct? As you can see, the data bar for California is longer than the one for Canada while the sales amount for Canada is definitely the higher one.&#160; An even nicer example is United Kingdom with only one state England.&#160; Both amounts are equal yet their data bars are certainly not.</p>
<p>Well, this is because the data bar by default uses the same scope as the group where it’s put.&#160; Canada and United Kingdom are in the Country group and all Country data bars compare nicely to each other.&#160; California and England are in the State/Province group and also compare nicely to each other!</p>
<p>Depending on the report’s requirements this may or may not be the desired effect.&#160; But I wouldn’t be mentioning this if there weren’t any other options, would I?</p>
<h3>Setting The Maximum Value Of The Horizontal Axis</h3>
<p>A correct column label for our current column would be <em>“% of group</em>”.&#160; Let’s add a second column which will show the percentage of the row compared to the total of the dataset, “<em>% of overall total</em>”.&#160; After adding the extra column, copy/paste the data bars from the first column over into the new textboxes in the second column.</p>
<p>To get what we want, we need to tell the data bar that the maximum for the horizontal axis is the total of the dataset and not the total of the grouping level of the table.&#160; So, right-click one of the data bars in the new column and select <strong>Horizontal Axis Properties</strong>.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Right-click menu on tablix textbox with a data bar" border="0" alt="Right-click menu on tablix textbox with a data bar" src="http://blog.hoegaerden.be/wp-content/uploads/image271.png" width="545" height="568" /></p>
<p>As you can see, the default for the <em>Maximum</em> value is set to “<em>Auto</em>”.&#160; Note that the name of my tablix is “Tablix1”, as shown in the <em>Align axes in</em> dropdown.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Horizontal Axis Properties" border="0" alt="Horizontal Axis Properties" src="http://blog.hoegaerden.be/wp-content/uploads/image272.png" width="585" height="530" /></p>
<p>Let’s replace the <em>Auto</em> as <strong>Maximum</strong> with the following expression:</p>
<pre class="code">=Sum(Fields!Reseller_Sales_Amount.Value, <span style="color: #a31515">&quot;Tablix1&quot;</span>)</pre>
<p>This expression says that we need the sum of the Reseller_Sales_Amount, scoped over the whole tablix.</p>
<p>Having changed the <strong>Maximum</strong> value on both data bars gives us the following preview:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image273.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Report rendered with status bar scoped over whole dataset" border="0" alt="Report rendered with status bar scoped over whole dataset" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb65.png" width="700" height="203" /></a></p>
<p>As you can see, this time around the data bars for England and United Kingdom have gotten the same size.&#160; Bars from different grouping levels can now be compared with each other.</p>
<h3>Showing Labels On The Data Bars</h3>
<p>In this report it would be interesting to add a label that displays the percentage to the status bars, so let’s do that.</p>
<p>For the percentage calculation of the first column of data bars we need to get the total of the current group and divide that by the total of the group one level higher.&#160; For the State/Province level that gives us the following expression:</p>
<pre class="code">=Sum(Fields!Reseller_Sales_Amount.Value)
    / Sum(Fields!Reseller_Sales_Amount.Value, <span style="color: #a31515">&quot;grpCountry&quot;</span>)</pre>
<p>The grpCountry refers to the name of the grouping one level higher, as shown in following screenshot:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="The groupings as defined on my example tablix" border="0" alt="The groupings as defined on my example tablix" src="http://blog.hoegaerden.be/wp-content/uploads/image274.png" width="680" height="103" /></p>
<p>And for the Country level we need this expression:</p>
<pre class="code">=Sum(Fields!Reseller_Sales_Amount.Value)
    / Sum(Fields!Reseller_Sales_Amount.Value, <span style="color: #a31515">&quot;Tablix1&quot;</span>)</pre>
<p>The only difference with the previous expression is the scope.</p>
<p>“Ok, so where do I type those expressions?” I hear you think.&#160; Right-click the Data Bar (after first selecting the textbox that contains it) and choose <strong>Show Data Labels</strong>.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Show Data Labels in right-click popup on Chart Series" border="0" alt="Show Data Labels in right-click popup on Chart Series" src="http://blog.hoegaerden.be/wp-content/uploads/image275.png" width="309" height="300" /></p>
<p>That adds a label to the chart but we still need to configure it to show the percentage.&#160; By default it uses the value as label.&#160; This can be verified in the <strong>Chart Series </strong>properties:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Chart Series properties: UseValueAsLabel" border="0" alt="Chart Series properties: UseValueAsLabel" src="http://blog.hoegaerden.be/wp-content/uploads/image276.png" width="287" height="392" /></p>
<p>The <strong>UseValueAsLabel</strong> is set to <em>True</em>, confirming what I just stated.&#160; Furthermore, activating the <strong>Show Data Labels </strong>option also set the <strong>Visible</strong> property to <em>True</em>.&#160; So another way of adding the label is by just setting this property to <em>True</em>.</p>
<p>Let’s now configure that label.&#160; Right-click it and select <strong>Series Label Properties</strong>.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Right-click menu on label" border="0" alt="Right-click menu on label" src="http://blog.hoegaerden.be/wp-content/uploads/image277.png" width="275" height="179" /></p>
<p>The General page of the <strong>Series Label Properties </strong>window allows you to define the Label data.&#160; That’s where you need to enter the expression that I mentioned earlier.</p>
<p>After you’ve entered the expression, the BIDS will ask you if you want to set the UseValueAsLabel to False, so click Yes.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Do you want to set the UseValueAsLabel to False?" border="0" alt="Do you want to set the UseValueAsLabel to False?" src="http://blog.hoegaerden.be/wp-content/uploads/image278.png" width="593" height="540" /></p>
<p>With the label selected as shown in the next screenshot you can use the formatting toolbar buttons to give it a decent font and all.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Data Bar with Label selected" border="0" alt="Data Bar with Label selected" src="http://blog.hoegaerden.be/wp-content/uploads/image279.png" width="207" height="37" /></p>
<p>For our second column of data bars the expressions need to take into account that we need the percentage as compared to all the data, unrelated to the level.&#160; This actually makes it easier because we can use the same expression on both the State/Province and Country level.&#160; Furthermore, it’s exactly the same expression as the one used on Country level in the first data bar column (i. e. the second expression above) because Country is the highest level.</p>
<p>Let’s have a look at the result in preview:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image280.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Preview of report with labels on data bars" border="0" alt="Preview of report with labels on data bars" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb66.png" width="700" height="185" /></a></p>
<p>Woah, looks like we forgot something doesn’t it?&#160; We forgot to format the label as being a percentage!&#160; There are two ways to get that done: through the <strong>Number</strong> page on the <strong>Series Label Properties </strong>window:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Series Label Properties: formatting number as percentage" border="0" alt="Series Label Properties: formatting number as percentage" src="http://blog.hoegaerden.be/wp-content/uploads/image281.png" width="585" height="482" /></p>
<p>Or by using the properties with the label selected (the Properties pane should show <strong>Chart Series Labels </strong>in the dropdown on top):</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Chart Series Labels properties" border="0" alt="Chart Series Labels properties" src="http://blog.hoegaerden.be/wp-content/uploads/image282.png" width="297" height="528" /></p>
<p>I’ve opted for a percentage without any decimals.</p>
<p>Let’s have another look at that report:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image283.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="The final report with two data bar columns" border="0" alt="The final report with two data bar columns" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb67.png" width="700" height="201" /></a></p>
<p>That sure looks better doesn’t it?&#160; The status bars on the right compare over the grouping levels while those on the left compare with each other within the same group.&#160; And they all have a clear label indicating what they represent.</p>
<p>And then colleague-expert <a title="mark_wills @ EE" href="http://www.experts-exchange.com/M_4390378.html" target="_blank">Mark Wills</a> jumps in with the following remark (rephrased a little):</p>
<blockquote>
<p>Hang on, are you really sure those bars on the left are what they should be?&#160; How&#8217;s it possible then that 71% of NSW (Australia) appears to be only about 20% and the 100% of England (United Kingdom) is only halfway filled?</p>
</blockquote>
<p>Interesting observation and indeed, Mark is right: those data bars on the left are still not right!&#160; Let’s get this fixed.</p>
<p>On the Country level the fix is really easy.&#160; What we want the bar to reflect here is the same as in the bar on the right: the percentage of the country compared to the whole dataset.&#160; That’s achieved using this expression as <em>Maximum</em> in the <strong>Horizontal Axis Properties</strong>:</p>
<pre class="code">=Sum(Fields!Reseller_Sales_Amount.Value, <span style="color: #a31515">&quot;Tablix1&quot;</span>)</pre>
<p>Here’s what that looks like:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Data bar on Country level now reflects the percentage of the group" border="0" alt="Data bar on Country level now reflects the percentage of the group" src="http://blog.hoegaerden.be/wp-content/uploads/image446.png" width="700" height="110" /></p>
<p>And finally, here’s the expression to be used to fix the data bar on State/Province level:</p>
<pre class="code">=Sum(Fields!Reseller_Sales_Amount.Value, <span style="color: #a31515">&quot;grpCountry&quot;</span>)</pre>
<p>Indeed, the data bar on this level should show the percentage compared to all the items in the group.</p>
<p>Final result:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="All data bars fully operational as advertised!" border="0" alt="All data bars fully operational as advertised!" src="http://blog.hoegaerden.be/wp-content/uploads/image447.png" width="700" height="200" /></p>
<p><strong>Conclusion:</strong> it’s not a good idea to leave the Maximum setting in the Horizontal Axis Properties set to “Auto”.</p>
<p>Have fun putting those data bars on your reports!</p>
<p>Valentino.</p>
<p><strong>References</strong></p>
<p><a title="BOL 2008R2: What&#39;s New (Reporting Services)" href="http://msdn.microsoft.com/en-us/library/ms170438%28v=SQL.105%29.aspx" target="_blank">BOL 2008R2: What&#8217;s New (Reporting Services)</a></p>
<p><a title="BOL 2008R2: Sparklines and Data Bars" href="http://msdn.microsoft.com/en-us/library/ee636365%28v=SQL.105%29.aspx" target="_blank">BOL 2008R2: Sparklines and Data Bars</a></p>
<p><a title="An Introduction to Data Bars in SQL Server Reporting Services 2008 R2" href="http://blogs.msdn.com/seanboon/archive/2009/11/23/an-introduction-to-data-bars-in-sql-server-reporting-services-2008-r2.aspx" target="_blank">An Introduction to Data Bars in SQL Server Reporting Services 2008 R2</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2010%2F05%2F27%2Fimplementing-data-bars-in-a-grouped-table%2F&amp;title=Implementing%20Data%20Bars%20In%20A%20Grouped%20Table" id="wpa2a_12"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2010/05/27/implementing-data-bars-in-a-grouped-table/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Looking Up Data On Different Sources</title>
		<link>http://blog.hoegaerden.be/2010/05/16/looking-up-data-on-different-sources/</link>
		<comments>http://blog.hoegaerden.be/2010/05/16/looking-up-data-on-different-sources/#comments</comments>
		<pubDate>Sun, 16 May 2010 12:41:27 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[Reporting Services 2008 R2]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SSRS]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/05/16/looking-up-data-on-different-sources/</guid>
		<description><![CDATA[Almost a year ago I wrote a small blog post to ask everyone to vote on a certain Connect item related to the linking of two datasets in a Reporting Services report.&#160; At this moment there have been 87 positive votes on the request. Now that SQL Server 2008 R2 has been RTM’ed, it’s time [...]]]></description>
			<content:encoded><![CDATA[<p>Almost a year ago I wrote <a title="Want to link datasets? Please vote!" href="http://blog.hoegaerden.be/2009/06/13/want-to-link-datasets-please-vote/">a small blog post</a> to ask everyone to vote on <a title="Merging / Linking datasets on report level (SSRS 2008)" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=419819" target="_blank">a certain Connect item</a> related to the linking of two datasets in a Reporting Services report.&#160; At this moment there have been 87 positive votes on the request.</p>
<p>Now that <a title="Microsoft SQL Server 2008 R2" href="http://www.microsoft.com/sqlserver/2008/en/us/r2.aspx" target="_blank">SQL Server 2008 R2</a> has been RTM’ed, it’s time to demonstrate new functionality in SSRS that allows the retrieval of data from another dataset, a dataset not linked to your data region.&#160; It’s not completely the same as actually joining two datasets, but it’s better than nothing – and it works!</p>
<p>In this article I’ll show you how exactly this works by using the new Lookup, LookupSet and MultiLookup SSRS functions.</p>
<p>I’m using the AdventureWorks 2008R2 relational database and the AdventureWorksDW 2008R2 data warehouse, <a title="AdventureWorks 2008R2 November CTP" href="http://msftdbprodsamples.codeplex.com/releases/view/24854" target="_blank">available from CodePlex</a>.&#160; The main data is coming from the data warehouse while all the lookups are done on the relational database.</p>
<h2>Setting Up A Basic Table Report</h2>
<p>In my report I’ve created a dataset called dsInternetSales.&#160; This dataset is retrieving data from the AdventureWorksDW2008R2 data warehouse using the following query:</p>
<pre class="code"><span style="color: blue">select </span>PROD<span style="color: gray">.</span>EnglishProductName<span style="color: gray">, </span>PROD<span style="color: gray">.</span>ProductAlternateKey<span style="color: gray">, </span>PROD<span style="color: gray">.</span>ListPrice<span style="color: gray">,
    </span>PSC<span style="color: gray">.</span>EnglishProductSubcategoryName<span style="color: gray">, </span>PC<span style="color: gray">.</span>EnglishProductCategoryName<span style="color: gray">,
    </span>S<span style="color: gray">.</span>OrderQuantity<span style="color: gray">, </span>S<span style="color: gray">.</span>SalesAmount
<span style="color: blue">from </span>FactInternetSales S
<span style="color: gray">inner join </span>DimProduct PROD <span style="color: blue">on </span>S<span style="color: gray">.</span>ProductKey <span style="color: gray">= </span>PROD<span style="color: gray">.</span>ProductKey
<span style="color: gray">inner join </span>DimProductSubcategory PSC
    <span style="color: blue">on </span>PROD<span style="color: gray">.</span>ProductSubcategoryKey <span style="color: gray">= </span>PSC<span style="color: gray">.</span>ProductSubcategoryKey
<span style="color: gray">inner join </span>DimProductCategory PC <span style="color: blue">on </span>PSC<span style="color: gray">.</span>ProductCategoryKey <span style="color: gray">= </span>PC<span style="color: gray">.</span>ProductCategoryKey</pre>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<p>Using that dataset, I’ve set up a Table as shown in following screenshot.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Basic Table Report" border="0" alt="Basic Table Report" src="http://blog.hoegaerden.be/wp-content/uploads/image249.png" width="630" height="294" /> </p>
<p>The Details group has been set up to group on ProductAlternateKey.&#160; On top of the Details group, I’ve grouped on EnglishProductSubcategoryName and the top-level group is grouping on EnglishProductCategoryName.&#160; The Order Quantity column is displaying the sum of the OrderQuantity values for each ProductAlternateKey.</p>
<p>The result is a report that shows all (internet) sales per product, without any filtering.&#160; Very useful report if you want to know how many items your company has sold since it’s existence.&#160; Okay, management would probably like to see some filtering on here, but that’s not the purpose of this article.</p>
<p>Here’s what it looks like in Preview:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Basic Table Report Rendered" border="0" alt="Basic Table Report Rendered" src="http://blog.hoegaerden.be/wp-content/uploads/image250.png" width="481" height="360" /> </p>
<p>&#160;</p>
<h2>Adding Data From Another Database</h2>
<p>Imagine now that you need to add an extra line under each product, containing the product description.&#160; But this description is not available in the data warehouse.&#160; In fact it could even be stored on another server.</p>
<p>In the example here we will retrieve the description from the AdventureWorks2008R2 relational database.</p>
<h3>Setting Up The Second Dataset</h3>
<p>I’ve created an additional dataset called dsProductInfo, using the following query:</p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<pre class="code"><span style="color: blue">select </span>P<span style="color: gray">.</span>ProductNumber<span style="color: gray">, </span>PD<span style="color: gray">.</span><span style="color: blue">Description
from </span>Production<span style="color: gray">.</span>Product P
<span style="color: gray">inner join </span>Production<span style="color: gray">.</span>ProductModel PM <span style="color: blue">on </span>P<span style="color: gray">.</span>ProductModelID <span style="color: gray">= </span>PM<span style="color: gray">.</span>ProductModelID
<span style="color: gray">inner join </span>Production<span style="color: gray">.</span>ProductModelProductDescriptionCulture PMPDC
    <span style="color: blue">on </span>PMPDC<span style="color: gray">.</span>ProductModelID <span style="color: gray">= </span>PM<span style="color: gray">.</span>ProductModelID
    <span style="color: gray">and </span>PMPDC<span style="color: gray">.</span>CultureID <span style="color: gray">= </span><span style="color: red">'en'
</span><span style="color: gray">inner join </span>Production<span style="color: gray">.</span>ProductDescription PD
    <span style="color: blue">on </span>PMPDC<span style="color: gray">.</span>ProductDescriptionID <span style="color: gray">= </span>PD<span style="color: gray">.</span>ProductDescriptionID</pre>
<p><a href="http://11011.net/software/vspaste"></a>Not only does it retrieve the product’s description, we’re also fetching the ProductNumber.&#160; Here’s what part of the result looks like:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Result of product description query" border="0" alt="Result of product description query" src="http://blog.hoegaerden.be/wp-content/uploads/image251.png" width="462" height="153" /> </p>
<p>The reason that we’re retrieving ProductNumber as well is because it matches with the ProductAlternateKey which we’ve retrieved earlier in our first dataset.&#160; And this is very important because that’s the key on which we’re going to link the datasets.</p>
<h3>Using The Lookup Function</h3>
<p>I’ve added an additional row inside the Details group and inserted a <a title="The Power Of The Placeholder" href="http://blog.hoegaerden.be/2009/04/07/the-power-of-the-placeholder/">Placeholder</a> to retrieve the product’s description, using the new <a title="BOL2008R2: Lookup Function" href="http://msdn.microsoft.com/en-us/library/ee210575%28v=SQL.105%29.aspx" target="_blank">Lookup function</a>.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Additional row inside Details group" border="0" alt="Additional row inside Details group" src="http://blog.hoegaerden.be/wp-content/uploads/image252.png" width="543" height="150" /> </p>
<p>So, what does the Placeholder’s expression look like?&#160; Here it is:</p>
<pre class="code">=Lookup(
    Fields!ProductAlternateKey.Value,
    Fields!ProductNumber.Value,
    Fields!Description.Value,
    <span style="color: #a31515">&quot;dsProductInfo&quot;
</span>)</pre>
<p><a href="http://11011.net/software/vspaste"></a>As you can see, the Lookup function requires four parameters.</p>
<p>The first parameter is the key value in your current dataset, the dataset used by the table data region.&#160; In our case that’s the ProductAlternateKey field in the dsInternetSales dataset.</p>
<p>The second parameter is the name of the key field in the second dataset, the one on which the lookup will happen.&#160; In our case that’s the ProductNumber in the dsProductInfo dataset.</p>
<p>The third parameter is the field from the second dataset that you’re wanting to retrieve using the lookup, in our case the Description field from dsProductInfo.</p>
<p>And finally, the last parameter is the name of the dataset on which you want to do the lookup.</p>
<p>Please note that parameter number four is a string parameter, so the value needs to be enclosed by double quotes.&#160; If you forget about that, you’ll get a couple of nice error messages like these:</p>
<blockquote>
<p>[rsInvalidLookupScope]&#160; The Value expression for the textrun ‘Textbox29.Paragraphs[0].TextRuns[0]’ has a scope parameter that is not valid for a lookup function. The scope parameter must be set to a string constant that is the name of a dataset.</p>
</blockquote>
<p>So, don’t forget the quotes.</p>
<p>With the Lookup call set up as explained, here’s the updated report Preview:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Rendered report with product descriptions added through Lookup" border="0" alt="Rendered report with product descriptions added through Lookup" src="http://blog.hoegaerden.be/wp-content/uploads/image253.png" width="518" height="594" /> </p>
<p>How cool is that huh?&#160; Each product has gotten a description, retrieved from another database, and still in the same table data region.&#160; Before R2 of SQL Server 2008, this wasn’t possible to achieve (well, not easily anyway) and now it’s actually fairly simple!</p>
<p>Is that all?&#160; Ha, I was kinda hoping that you were going to ask that.&#160; No, it’s not all, there are two more new lookup functions: LookupSet and MultiLookup.</p>
<h3>More Lookups: The LookupSet Function</h3>
<p>In case you’re wondering, in the Expression Builder the new lookup functions are located under the Miscellaneous node:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image254.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Expression Builder: the new lookup functions are under Miscellaneous" border="0" alt="Expression Builder: the new lookup functions are under Miscellaneous" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb61.png" width="682" height="231" /></a> </p>
<p>Let’s say that you want to add another detail row, this time it needs to show all colors in which the product is manufactured.&#160; Again this additional info is coming from the AdventureWorks relational database.</p>
<p>I’ve created a dataset called dsProductColors using the following query:</p>
<pre class="code"><span style="color: blue">select distinct </span><span style="color: gray">LEFT(</span>P<span style="color: gray">.</span>ProductNumber<span style="color: gray">, </span>6<span style="color: gray">) </span><span style="color: blue">as </span>ProductCodeWithoutColorAndSize<span style="color: gray">,
    </span>P<span style="color: gray">.</span>Color
<span style="color: blue">from </span>Production<span style="color: gray">.</span>Product P
<span style="color: blue">where </span>P<span style="color: gray">.</span>Color <span style="color: gray">is not null</span></pre>
<p><a href="http://11011.net/software/vspaste"></a>When looking at the product codes, I noticed that for the products which are available in several colors and sizes, the last four characters represent the color and size.&#160; Which means the first six characters define the product itself, without color or size.&#160; That’s why the query is using the Left function to create a product code of only the first six characters of the ProductNumber.&#160; Using the distinct keyword, we remove any duplicate records.</p>
<p>(Please note that I’m not 100% sure if this logic applies to all products but for this demo it’s fine.)</p>
<p>Here’s what the query retrieves:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="List of product colors per product" border="0" alt="List of product colors per product" src="http://blog.hoegaerden.be/wp-content/uploads/image255.png" width="264" height="321" /> </p>
<p>As you can see, for some products there’s more than one record.&#160; And that’s exactly what the <a title="BOL2008R2: LookupSet Function" href="http://msdn.microsoft.com/en-us/library/ee210576%28v=SQL.105%29.aspx" target="_blank">LookupSet function</a> was made for: it retrieves a set of data based on the key given to it.&#160; This is different from the Lookup, where for each key value it would fetch only one value.</p>
<p>Again I’ve added an additional row inside the Details group and used a placeholder with the following expression:</p>
<pre class="code">=Join(
    LookupSet(
        Left(Fields!ProductAlternateKey.Value, 6),
        Fields!ProductCodeWithoutColorAndSize.Value,
        Fields!Color.Value,
        <span style="color: #a31515">&quot;dsProductColors&quot;
    </span>),
    <span style="color: #a31515">&quot;, &quot;
</span>)</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>The LookupSet call itself looks very similar to the Lookup, with the same four parameters.&#160; I’ve used the Left function on the first parameter to apply the same logic to the ProductAlternateKey as we did with the ProductNumber.</p>
<p>However, there’s one important difference: the call of the Join function.&#160; This is needed because the LookupSet is returning a set, or better, a VariantArray, not just a single value.&#160; And an array cannot be visualized without first concatenating the values somehow.&#160; With the Join, we can concatenate the different values, using a comma as separator.</p>
<p>And here’s the resulting report:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Our report displaying the list of colors for each product" border="0" alt="Our report displaying the list of colors for each product" src="http://blog.hoegaerden.be/wp-content/uploads/image256.png" width="519" height="341" /> </p>
<p>With the first two lookup functions covered there’s one more to go.</p>
<h3>Just One More Lookup: The MultiLookup Function</h3>
<p>Guess what crazy request the business people have come up with this time?!&#160; The report should have a multi-value filter on region, and for each region selected, the top of the table should list the number of shops opened in the first year in those regions.&#160; For example, if the first shop in France was opened in 1970 and in that same year there were two other shops opened in France, the report should state “France: 3 shop(s) opened in 1970”.</p>
<p>Ow, and that list should be located right under the main header so deciding to use a textbox outside of the table is not a good idea <img src='http://blog.hoegaerden.be/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Sounds like we can use the <a title="BOL2008R2: Multilookup Function" href="http://msdn.microsoft.com/en-us/library/ee210583%28v=SQL.105%29.aspx" target="_blank">MultiLookup</a> function for this request.&#160; But let’s first set up the filter.</p>
<p>I’ve created a dataset called dsRegions, using the following query on the data warehouse:</p>
<pre class="code"><span style="color: blue">select </span>DST<span style="color: gray">.</span>SalesTerritoryAlternateKey<span style="color: gray">,
    </span>DST<span style="color: gray">.</span>SalesTerritoryCountry <span style="color: gray">+ </span><span style="color: red">' - ' </span><span style="color: gray">+ </span>DST<span style="color: gray">.</span>SalesTerritoryRegion <span style="color: blue">as </span>CountryRegion
<span style="color: blue">from </span>DimSalesTerritory DST
<span style="color: blue">where </span>DST<span style="color: gray">.</span>SalesTerritoryAlternateKey <span style="color: gray">&gt; </span>0</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Then I’ve added a multi-value parameter called Regions with the Available Values coming from the dsRegions dataset.</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Regions parameter: the Available Values" border="0" alt="Regions parameter: the Available Values" src="http://blog.hoegaerden.be/wp-content/uploads/image257.png" width="585" height="482" /> </p>
<p>This parameter can now be used in our main dataset.&#160; Here’s the updated query:</p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<pre class="code"><span style="color: blue">select </span>PROD<span style="color: gray">.</span>EnglishProductName<span style="color: gray">, </span>PROD<span style="color: gray">.</span>ProductAlternateKey<span style="color: gray">, </span>PROD<span style="color: gray">.</span>ListPrice<span style="color: gray">,
    </span>PSC<span style="color: gray">.</span>EnglishProductSubcategoryName<span style="color: gray">, </span>PC<span style="color: gray">.</span>EnglishProductCategoryName<span style="color: gray">,
    </span>S<span style="color: gray">.</span>OrderQuantity<span style="color: gray">, </span>S<span style="color: gray">.</span>SalesAmount
<span style="color: blue">from </span>FactInternetSales S
<span style="color: gray">inner join </span>DimProduct PROD <span style="color: blue">on </span>S<span style="color: gray">.</span>ProductKey <span style="color: gray">= </span>PROD<span style="color: gray">.</span>ProductKey
<span style="color: gray">inner join </span>DimProductSubcategory PSC
    <span style="color: blue">on </span>PROD<span style="color: gray">.</span>ProductSubcategoryKey <span style="color: gray">= </span>PSC<span style="color: gray">.</span>ProductSubcategoryKey
<span style="color: gray">inner join </span>DimProductCategory PC <span style="color: blue">on </span>PSC<span style="color: gray">.</span>ProductCategoryKey <span style="color: gray">= </span>PC<span style="color: gray">.</span>ProductCategoryKey
<span style="color: gray">inner join </span>DimSalesTerritory DST <span style="color: blue">on </span>S<span style="color: gray">.</span>SalesTerritoryKey <span style="color: gray">= </span>DST<span style="color: gray">.</span>SalesTerritoryKey
<span style="color: blue">where </span>DST<span style="color: gray">.</span>SalesTerritoryAlternateKey <span style="color: gray">in (</span>@Regions<span style="color: gray">)</span></pre>
<p><a href="http://11011.net/software/vspaste"></a>The only difference with the previous query are the two last lines: we add DimSalesTerritory to the joins and filter it on SalesTerritoryAlternateKey.</p>
<p>Don’t forget to set up the parameter.</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Setting up the parameter on dsInternetSales" border="0" alt="Setting up the parameter on dsInternetSales" src="http://blog.hoegaerden.be/wp-content/uploads/image258.png" width="600" height="234" /> </p>
<p>With the filter implemented, let’s get started on that extra lookup.&#160; </p>
<p>First we need to add the dataset containing the data that we need.&#160; I’ve created a dataset called dsShopsOpenedInFirstYear, using the following query on the relational database:</p>
<pre class="code"><span style="color: blue">with </span>ShopOpened <span style="color: blue">as
</span><span style="color: gray">(
    </span><span style="color: blue">select </span>T<span style="color: gray">.</span>TerritoryID<span style="color: gray">, </span>T<span style="color: gray">.</span>Name Territory<span style="color: gray">, </span>S<span style="color: gray">.</span>Name ShopName<span style="color: gray">,
        </span>S<span style="color: gray">.</span>[Demographics]<span style="color: gray">.</span>value<span style="color: gray">(</span><span style="color: red">'declare default element namespace &quot;http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey&quot;;
        (/StoreSurvey/YearOpened)[1]'</span><span style="color: gray">, </span><span style="color: red">'integer'</span><span style="color: gray">) </span><span style="color: blue">AS </span>[YearOpened]
    <span style="color: blue">from </span>Sales<span style="color: gray">.</span>Store S
    <span style="color: gray">inner join </span>Sales<span style="color: gray">.</span>SalesPerson SP <span style="color: blue">on </span>S<span style="color: gray">.</span>SalesPersonID <span style="color: gray">= </span>SP<span style="color: gray">.</span>BusinessEntityID
    <span style="color: gray">inner join </span>Sales<span style="color: gray">.</span>SalesTerritory T <span style="color: blue">on </span>SP<span style="color: gray">.</span>TerritoryID <span style="color: gray">= </span>T<span style="color: gray">.</span>TerritoryID
<span style="color: gray">),
</span>FirstShopOpened <span style="color: blue">as
</span><span style="color: gray">(
    </span><span style="color: blue">select </span><span style="color: magenta">MIN</span><span style="color: gray">(</span>YearOpened<span style="color: gray">) </span>YearOpened<span style="color: gray">, </span>TerritoryID
    <span style="color: blue">from </span>ShopOpened
    <span style="color: blue">group by </span>TerritoryID
<span style="color: gray">)
</span><span style="color: blue">select </span>SO<span style="color: gray">.</span>TerritoryID<span style="color: gray">,
    </span>SO<span style="color: gray">.</span>Territory <span style="color: gray">+ </span><span style="color: red">': ' </span><span style="color: gray">+ </span><span style="color: magenta">CAST</span><span style="color: gray">(</span><span style="color: magenta">COUNT</span><span style="color: gray">(*) </span><span style="color: blue">as varchar</span><span style="color: gray">(</span>100<span style="color: gray">)) +
    </span><span style="color: red">' shop(s) opened in ' </span><span style="color: gray">+ </span><span style="color: magenta">CAST</span><span style="color: gray">(</span>SO<span style="color: gray">.</span>YearOpened <span style="color: blue">as char</span><span style="color: gray">(</span>4<span style="color: gray">)) </span><span style="color: blue">as </span>ShopString
<span style="color: blue">from </span>FirstShopOpened FSO
<span style="color: gray">inner join </span>ShopOpened SO <span style="color: blue">on </span>SO<span style="color: gray">.</span>TerritoryID <span style="color: gray">= </span>FSO<span style="color: gray">.</span>TerritoryID
    <span style="color: gray">and </span>SO<span style="color: gray">.</span>YearOpened <span style="color: gray">= </span>FSO<span style="color: gray">.</span>YearOpened
<span style="color: blue">group by </span>SO<span style="color: gray">.</span>TerritoryID<span style="color: gray">, </span>SO<span style="color: gray">.</span>Territory<span style="color: gray">, </span>SO<span style="color: gray">.</span>YearOpened</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>This query uses a couple of <a title="BOL2008: Using Common Table Expressions" href="http://msdn.microsoft.com/en-us/library/ms190766.aspx" target="_blank">Common Table Expressions</a> to get to the result as we need it.&#160; The first CTE, ShopOpened, creates a list of all shops with their territory and the opening year.&#160; The second CTE, FirstShopOpened uses the ShopOpened CTE to retrieve the first opening year for each territory.</p>
<p>And finally the main query uses both CTEs to create the following result:</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Number of shops opened in first year per territory" border="0" alt="Number of shops opened in first year per territory" src="http://blog.hoegaerden.be/wp-content/uploads/image259.png" width="336" height="236" /> </p>
<p>For each territory we’ve constructed a string that shows how many shops were opened in the first year of that region, and in what year it happened.&#160; Coincidentally all regions had shops opened in 1970.</p>
<p>The TerritoryID corresponds with the SalesTerritoryAlternateKey, which is the value of our Regions parameter.</p>
<p>I’ve added an extra row under the top row in the table data region, and I’m using the following expression in that row:</p>
<pre class="code">=Join(
    MultiLookup(
        Parameters!Regions.Value,
        Fields!TerritoryID.Value,
        Fields!ShopString.Value,
        <span style="color: #a31515">&quot;dsShopsOpenedInFirstYear&quot;
    </span>),
    <span style="color: #a31515">&quot;&lt;br&gt;&quot;
</span>)</pre>
<p>The MultiLookup takes four parameters, just like the two previous lookup functions.&#160; They are all the same, except for the first one.&#160; It may not be very obvious in the example here, but the Parameters!Regions.Value is in fact not just a single value.&#160; It’s an array because we’ve set up the parameter as being multi-valued.</p>
<p>And that’s exactly what the MultiLookup function requires.&#160; Here’s the description for that first parameter, as stated in the Books Online:</p>
<blockquote>
<p>(<strong>VariantArray</strong>) An expression that is evaluated in the current scope and that specifies the set of names or keys to look up. For example, for a multivalue parameter, <code>=Parameters!IDs.value</code>.</p>
</blockquote>
<p>Just like the LookupSet function, MultiLookup returns a VariantArray, so we use the Join function to concatenate the values.</p>
<p>Interesting to note here is that I’m adding the break HTML tag as separator.&#160; I want the result of the expression to be treated as HTML, so that each value retrieved ends up at a new line in the textbox.&#160; To get this to work as expected, you need to tell the Placeholder that the resulting value should be treated as HTML:</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Using HTML in a Placeholder" border="0" alt="Using HTML in a Placeholder" src="http://blog.hoegaerden.be/wp-content/uploads/image260.png" width="592" height="479" /> </p>
<p>Everything is now set up to have another report Preview.&#160; The following screenshot shows the report with the data filtered on Canada, France and Australia:</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="The final report performing three different lookups" border="0" alt="The final report performing three different lookups" src="http://blog.hoegaerden.be/wp-content/uploads/image261.png" width="518" height="452" /> </p>
<p>Seems to be working fine, doesn’t it?</p>
<p>Okay, that’s it for now, have fun looking up that data!</p>
<p>Valentino.</p>
<p><strong>References</strong></p>
<p><a title="BOL2008R2: Lookup Function" href="http://msdn.microsoft.com/en-us/library/ee210575%28v=SQL.105%29.aspx" target="_blank">BOL2008R2: Lookup Function</a></p>
<p><a title="BOL2008R2: LookupSet Function" href="http://msdn.microsoft.com/en-us/library/ee210576%28v=SQL.105%29.aspx" target="_blank">BOL2008R2: LookupSet Function</a></p>
</p>
<p><a title="BOL2008R2: MultiLookup Function" href="http://msdn.microsoft.com/en-us/library/ee210583%28v=SQL.105%29.aspx" target="_blank">BOL2008R2: MultiLookup Function</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2010%2F05%2F16%2Flooking-up-data-on-different-sources%2F&amp;title=Looking%20Up%20Data%20On%20Different%20Sources" id="wpa2a_14"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2010/05/16/looking-up-data-on-different-sources/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Memory Dumps And Crazy Code Samples</title>
		<link>http://blog.hoegaerden.be/2010/02/06/memory-dumps-and-crazy-code-samples/</link>
		<comments>http://blog.hoegaerden.be/2010/02/06/memory-dumps-and-crazy-code-samples/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 10:53:29 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[memory dump]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/02/06/memory-dumps-and-crazy-code-samples/</guid>
		<description><![CDATA[I usually don’t write posts just to mention a link to another site.  Except when I’ve come across articles which are so good that I want everyone to know about them.  Here are a couple of articles in that particular category. What Does Microsoft Do With Those Memory Dumps? The first one is written by [...]]]></description>
			<content:encoded><![CDATA[<p>I usually don’t write posts just to mention a link to another site.  Except when I’ve come across articles which are so good that I want everyone to know about them.  Here are a couple of articles in that particular category.</p>
<h2>What Does Microsoft Do With Those Memory Dumps?</h2>
<p>The first one is written by <strong>Adam W. Saxton</strong>, a member of the <a title="CSS SQL Server Engineers blog" href="http://blogs.msdn.com/psssql/default.aspx" target="_blank">Microsoft Customer Service and Support (CSS) SQL Server Escalation Services team</a>.</p>
<p>The subject of the post is an issue that developers of Reporting Services reports may come across: <strong><em>“InvalidReportParameterException</em></strong> <strong>with Data Driven Subscription”</strong>.  The report complains about an invalid parameter while the parameters seem to be okay, visually.  Then the author goes on to describe the actual issue: trailing spaces!  If you’ve been doing BI for a while, this is a quite common issue.  Adam also shows the difference between the <a title="BOL 2008: LEN (Transact-SQL)" href="http://msdn.microsoft.com/en-us/library/ms190329.aspx" target="_blank">LEN()</a> and the <a title="BOL 2008: DATALENGTH (Transact-SQL)" href="http://msdn.microsoft.com/en-us/library/ms173486.aspx" target="_blank">DATALENGTH()</a> functions.</p>
<p>But that’s not the reason that I’m mentioning that article here.  The best part starts following the Summary chapter, and is entitled <strong>Techie Details</strong>.  In that extra chapter he shows how the CSS team uses those crash memory dumps which I’m sure you’ve all seen now and then. </p>
<p>I won’t give you any details about that, just<strong> </strong><a title="InvalidReportParameterException with Data Driven Subscription" href="http://blogs.msdn.com/psssql/archive/2009/12/10/invalidreportparameterexception-with-data-driven-subscription.aspx" target="_blank"><strong>have a look at the article</strong></a>.  If you’re a developer, there’s some very valuable information there!</p>
<p>I am definitely looking forward to seeing his pre-conference session at the <a title="PASS European Conference 2010" href="http://www.sqlpass.org/summit/eu2010/" target="_blank">SQL PASS European Conference in Germany</a> this year: <a title="Pre-Conference Sessions: PASS European Conference 2010 - Tackling Top Reporting Services Issues" href="http://www.sqlpass.org/summit/eu2010/Agenda/PreConference/TacklingTopReportingServicesIssues.aspx" target="_blank">Tackling Top Reporting Services Issues</a>!</p>
<h2>Some Crazy Code Samples</h2>
<p>The second article that I’d like to mention here is written by <a title="Phil Factor" href="http://www.simple-talk.com/author/phil-factor/" target="_blank">Phil Factor</a>, a regular at the <a title="simple-talk" href="http://www.simple-talk.com" target="_blank">Simple-Talk</a> site.</p>
<p>This article is called <a title="Laying out SQL Code" href="http://www.simple-talk.com/sql/t-sql-programming/laying-out-sql-code" target="_blank">Laying out SQL Code</a> and mentions some database naming conventions and T-SQL coding layout, as the title already implies.  Even if you’re not interested in that (although as a serious developer you should be!!), the article is worth the effort of reading just for its code samples.</p>
<p>Here’s my favorite one:</p>
<pre class="code"><span style="color: blue">CREATE TABLE </span>"╚╦╩╗" <span style="color: gray">( </span>"└┬┴┐" <span style="color: blue">nvarchar</span><span style="color: gray">(</span>10<span style="color: gray">))
</span><span style="color: blue">DECLARE </span>@ <span style="color: blue">nvarchar</span><span style="color: gray">(</span>10<span style="color: gray">)  </span><span style="color: blue">set </span>@<span style="color: gray">=</span><span style="color: red">'═'
</span><span style="color: blue">INSERT  INTO </span>"╚╦╩╗"
        <span style="color: gray">( </span>"└┬┴┐" <span style="color: gray">)
        </span><span style="color: blue">SELECT  </span><span style="color: magenta">replicate</span><span style="color: gray">(</span>@<span style="color: gray">,</span>5<span style="color: gray">)

</span><span style="color: blue">SELECT  </span><span style="color: gray">*
</span><span style="color: blue">FROM    </span>"╚╦╩╗"</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>And just to prove to you that this really is valid code, here’s the result:</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Result of crazy query" src="http://blog.hoegaerden.be/wp-content/uploads/image173.png" border="0" alt="Result of crazy query" width="123" height="71" /></p>
<p>So, how about that database for that plumbing company? <img src='http://blog.hoegaerden.be/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>BTW: when running that code without paying attention to the details (such as what DB your SSMS is connected to), you may end up with something like this:</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Silly table stored in master DB - that's not a best practice!" src="http://blog.hoegaerden.be/wp-content/uploads/image174.png" border="0" alt="Silly table stored in master DB - that's not a best practice!" width="192" height="94" /> </p>
<p>So you may want to clean up after running the query using this statement:</p>
<pre class="code"><span style="color: blue">drop table </span>"╚╦╩╗"</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Have fun!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2010%2F02%2F06%2Fmemory-dumps-and-crazy-code-samples%2F&amp;title=Memory%20Dumps%20And%20Crazy%20Code%20Samples" id="wpa2a_16"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2010/02/06/memory-dumps-and-crazy-code-samples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Your First OLAP Report</title>
		<link>http://blog.hoegaerden.be/2010/01/24/your-first-olap-report/</link>
		<comments>http://blog.hoegaerden.be/2010/01/24/your-first-olap-report/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 13:28:32 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Analysis Services]]></category>
		<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[MDX]]></category>
		<category><![CDATA[Reporting Services 2008]]></category>
		<category><![CDATA[SSAS]]></category>
		<category><![CDATA[SSRS]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/01/24/your-first-olap-report/</guid>
		<description><![CDATA[Introduction This article is aimed at report developers who are used to develop reports using relational databases and have gotten a first-time assignment to develop reports on OLAP cubes. It demonstrates how to build a report using SQL Server Reporting Services 2008 with data coming from an OLAP cube running on SQL Server Analysis Services [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>This article is aimed at report developers who are used to develop reports using relational databases and have gotten a first-time assignment to develop reports on OLAP cubes.</p>
<p>It demonstrates how to build a report using SQL Server Reporting Services 2008 with data coming from an OLAP cube running on SQL Server Analysis Services 2008.</p>
<p>The OLAP database used in the article is called “Adventure Works DW 2008”, available for <a title="CodePlex - SQL Server 2008 SR4 sample databases" href="http://msftdbprodsamples.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=37109" target="_blank">download at CodePlex</a>.</p>
<p>If you’re fairly new to Reporting Services (aka SSRS) and you find that this article is going a bit too fast, I’d like to point you to my other article which explains <a title="Reporting On Data From Stored Procedures (part 1)" href="http://blog.hoegaerden.be/2009/11/10/reporting-on-data-from-stored-procedures-part-1/">how to build a report that’s retrieving data using regular stored procedures</a>.</p>
<h2>OLAP &lt;&gt; OLTP</h2>
<p>When people are talking about databases, what they are usually referring to are “regular” relational <strong>OLTP</strong> databases.&#160; OLTP stands for Online Transaction Processing.&#160; As the name implies, these types of databases are built to handle many simultaneous transactions (consisting of actions such as inserts, updates, deletes) in real-time.&#160; I’m sure you’re familiar with these types of database so I won’t go further into them.</p>
<p><strong>OLAP</strong> (Online Analytical Processing) on the other hand is a totally different story.&#160; OLAP cubes are built to answer multi-dimensional analytical queries as fast as possible.&#160; For that purpose, what you can find in such a database are <strong>measures</strong> (these are the numbers) stored in cubes, and <strong>dimensions</strong> which allow filtering the measures.&#160; This filtering is often referred to as slicing and dicing.&#160; Furthermore, OLAP cubes contain pre-aggregated data, again to be able to answer queries as fast as possible.</p>
<p>Let’s make this clear with an example.&#160; Imagine the following request: </p>
<blockquote><p>“Give me the sum of all sales of product X for period Y in country Z.”</p>
</blockquote>
<p>Three dimensions can be recognized in that request: “product X” is found in the <strong>Product</strong> dimension, “period Y” in the <strong>Date</strong> dimension and “country Z” in the <strong>Geography</strong> dimension.&#160; (I’ve used the actual dimension names as they are called in the Adventure Works OLAP database.)</p>
<p>Each dimension consists of <strong>attributes</strong> and <strong>attribute hierarchies</strong> and it’s those attributes that you’re actually referring to when building an <strong>MDX</strong> query.&#160; MDX stands for Multidimensional Expressions and that is the language used to query an OLAP database, just like you use SQL to query a relational database.</p>
<p>Looking at our example, what we need is for the Product attribute in the Product dimension to be equal to X.&#160; An attribute in a dimension can also be written as [Dimension].[Attribute], thus we also want [Date].[Date] to be equal to Y and [Geography].[Country] equal to Z.</p>
<p>As for the measure part, that’s what “the sum of all sales” is referring to.&#160; When looking at the measures available in the Adventure Works cube, one of the measures that would fulfill the request is the <strong>Reseller Sales Amount</strong> in the Reseller Sales measure group.&#160; The Analysis Services engine searches the cube and retrieves the aggregated number for [Measures].[Reseller Sales Amount] available at the intersection of [Product].[Product] X, [Date].[Date] Y and [Geography].[Country] Z.</p>
<p>OLAP cubes are usually, although not necessarily, build on top of a data warehouse.&#160; In SQL Server, a data warehouse is still a relational database, unlike an OLAP cube, but the table structure is different from an OLTP database.&#160; A data warehouse contains tables that represent dimensions and other tables that contain the facts.&#160; The facts are the numbers, so the measures that were mentioned earlier.&#160; This is called a dimensional model.&#160; Dimensional modeling was invented by Ralph Kimball, one of the pioneers in data warehousing.&#160; For completeness I’d like to mention that another data warehousing approach was described by Bill Inmon.&#160; I’ll leave it up to you to do some research on both approaches and decide for yourself which one you prefer, possibly even a mix of both.</p>
<p>As far as the “Adventure Works DW 2008” OLAP database is concerned, it’s built on top of the AdventureWorksDW2008 dimensional database.</p>
<p>Okay, I believe this theoretical explanation was sufficient for now, let’s start with the report!</p>
<h2>Your First Report</h2>
<h3>Business Requirements</h3>
<p>You’ve gotten the assignment to create a report that shows the reseller sales numbers by region.&#160; The highest level to be shown is Country, with drilldown through State/Province to City.</p>
<h3>Creating The Shared Data Source</h3>
<p>Just like when building reports on OLTP databases, we’re not going anywhere without a Data Source.&#160; I’m going to create a Shared Data Source called OLAP_AdventureWorks.rds:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Shared Data Source connecting to Adventure Works OLAP Database" border="0" alt="Shared Data Source connecting to Adventure Works OLAP Database" src="http://blog.hoegaerden.be/wp-content/uploads/image148.png" width="577" height="478" /> </p>
<p>The Type that we need is <strong>Microsoft SQL Server Analysis Services</strong>, which is the SQL Server service that’s running the OLAP databases.&#160; Furthermore I’ve selected the “Adventure Works DW 2008” database.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Connection Properties specifying the Adventure Works DW 2008 OLAP database" border="0" alt="Connection Properties specifying the Adventure Works DW 2008 OLAP database" src="http://blog.hoegaerden.be/wp-content/uploads/image149.png" width="308" height="410" /> </p>
<p>There’s no need to type the database name yourself.&#160; After you’ve provided sufficient credentials in the Credentials page, you can just select it from the dropdown in the Connection Properties screen.&#160; This screen is opened by clicking that Edit button on the Shared Data Source Properties window.</p>
<h3>Your First OLAP Dataset</h3>
<p>I’ve created a new report called FirstOLAPReport.rdl.&#160; In that report I’ve specified that I’ll be using the Shared Data Source created earlier.&#160; This source is known as srcAdventureWorksOLAP in my report.</p>
<p>Next step is to create the dataset.&#160; I’m calling it dsResellerSalesByRegion.&#160; As this is our first OLAP report, we’re not going to write the MDX ourselves but we will use the Query Designer which is opened by clicking the button that has the words Query Designer printed on them, how difficult can that be?!</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="How to open the MDX Query Designer" border="0" alt="How to open the MDX Query Designer" src="http://blog.hoegaerden.be/wp-content/uploads/image150.png" width="577" height="478" /> </p>
<p>The BIDS knows that it should open the MDX Query Designer because our data source is connecting to an Analysis Services server.&#160; All we need to do now is to drag the measures and dimension attributes that we require into the area marked with “Drag levels or measures here to add to the query.”.</p>
<p>Let’s start by dragging our measures into that area.&#160; We need two measures, both located in the Reseller Sales measure group.&#160; They are called Reseller Order Quantity and Reseller Sales Amount.&#160; Following screenshot shows the situation after the first measure has been added.&#160; The second measure was being dragged into it as well.&#160; When dragging items into the area, a vertical blue line appears to indicate where the item can be added.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="MDX Query Designer: dragging a measure into the query" border="0" alt="MDX Query Designer: dragging a measure into the query" src="http://blog.hoegaerden.be/wp-content/uploads/image151.png" width="627" height="706" /> </p>
<p>Next I’m going to drag the Geography hierarchy, located in the Geography dimension, into the design area.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="MDX Query Designer: dragging a hierarchy into the query" border="0" alt="MDX Query Designer: dragging a hierarchy into the query" src="http://blog.hoegaerden.be/wp-content/uploads/image152.png" width="620" height="647" /> </p>
<p>Now we’ve got all the data we need for our report.</p>
<p>As you have noticed, the Query Designer automatically executes the query each time it gets modified when you’re dragging an item into the design area.&#160; If you don’t want this behaviour, it can be switched off by clicking the <strong>Auto Execute</strong> button in the toolbar (indicated by a red 1 in the screenshot below).</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Query Designer toolbar" border="0" alt="Query Designer toolbar" src="http://blog.hoegaerden.be/wp-content/uploads/image153.png" width="487" height="61" /> </p>
<p>Another interesting button is the <strong>Design Mode</strong> button (indicated by a green 2).&#160; This one allows you to toggle between the graphical designer and the text editor.&#160; By clicking it you can see the actual MDX query that the designer has prepared for you.</p>
<p>As you can see, the query is nicely formatted using capitals for the keywords and so on.&#160; Well, no, actually it’s the worst editor around!&#160; No syntax coloring, no multi-line formatting, nothing.&#160; So if you are going to take a close look at the query, I recommend you to use the Management Studio.&#160; Connect to your Analysis Services server, locate your database and right-click it in the Object Explorer.&#160; Then choose New Query &gt; MDX and paste the query into that new window.&#160; You’ll still need to manually break it down into different lines but at least you get syntax coloring.&#160; Furthermore, if you’re going to make manual modifications to it, you’ve got some command completion and error indicators as well.</p>
<p>Please take into account that once you’ve made manual changes to your query, you cannot switch back to the graphical designer.&#160; Well, you can, but you will lose all manual modifications.&#160; Don’t worry about doing it accidentally though, a nice pop-up will warn you:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Warning message when switching back to design mode." border="0" alt="Warning message when switching back to design mode." src="http://blog.hoegaerden.be/wp-content/uploads/image154.png" width="611" height="131" /> </p>
<p>Something else that you’ll also notice is that the results displayed in the Query Designer and those displayed in the Management Studio are not exactly the same.&#160; That’s because both environments interpret the results differently.&#160; Remember, you’re not retrieving two-dimensional row/column data like with a SQL query.&#160; You’re retrieving multi-dimensional data!</p>
<p>If you take a closer look at the query that we’ve produced above, it’s similar to this:</p>
<pre class="code"><span style="color: blue">SELECT </span>something <span style="color: blue">ON COLUMNS</span>,
    something_else <span style="color: blue">ON ROWS
FROM </span>[Adventure Works]</pre>
<div>That query is selecting data on two axes: COLUMNS and ROWS.&#160; But in fact, MDX supports up to 128 axes.&#160; However, the client tools that we are using here are not able to visualize that kind of cellset (as the result set of an MDX query is also called).</div>
<div>&#160;</div>
<div>Okay, enough about our dataset.&#160; We’ve got the data, let’s put it on the report!</div>
<div>&#160;</div>
<h3>Displaying The Result Set</h3>
<p>As a reference, these are the fields available in our dataset:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Fields available in OLAP dataset" border="0" alt="Fields available in OLAP dataset" src="http://blog.hoegaerden.be/wp-content/uploads/image155.png" width="210" height="226" /> </p>
<p>Without going into too much detail – there’s no difference compared to reporting off a relational database &#8211; I’ve set up a table with three grouping levels on the rows.&#160; I’ve also added some makeup like background colors and font modifications.</p>
<p>As shown in following screenshot, the highest-level group is Country, followed by State_Province and City to conclude, just as specified in the requirements mentioned at the start of this chapter.</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image156.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Table with three groupings defined" border="0" alt="Table with three groupings defined" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb40.png" width="676" height="208" /></a> </p>
<p>Rendering the report in preview gives us something like this:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image157.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Report without any numeric formatting applied" border="0" alt="Report without any numeric formatting applied" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb41.png" width="677" height="382" /></a> </p>
<p>What is still missing at this point is decent formatting for those numbers!&#160; And here’s where we can take advantage of the fact that we’re retrieving data from an OLAP cube.&#160; A cube developer has the possibility to define the format for the measures in the cube itself.&#160; Doing that ensures that the same formatting is applied no matter what OLAP client tool is used.&#160; Any client that supports this way of formatting will show the numbers using the same format.</p>
<p>As you’ve seen in that last screenshot, there’s no formatting applied at all.&#160; Does this mean that there was no format defined in the cube?&#160; Let’s find out!</p>
<h4>A Little Walk Into The Analysis Project</h4>
<p>We are going to open up the Analysis Services project that contains the cube definition.&#160; If you don’t have any experience with SSAS, don’t worry!&#160; We will just have a look at a couple of properties and that’s it, plus I’ll explain each step as needed.&#160; In case you’ve forgotten where the sources are located, this is the default location: C:\Program Files\Microsoft SQL Server\100\Tools\Samples\AdventureWorks Analysis Services Project\.&#160; I’m opening the project located under the \enterprise subfolder by double-clicking the <em>Adventure Works.sln</em> file.</p>
<p>Once the project is loaded into the BIDS, locate and open the <em>Adventure Works.cube</em> in the Solution Explorer.&#160; You can find it in the <em>Cubes</em> folder of the <strong>Adventure Works DW</strong> project.</p>
<p>By default it will open the cube Design showing the first page called <strong>Cube Structure</strong>.&#160; At the top-left, we’ve got the Measures pane.&#160; The measures are shown in measure groups.&#160; Open the group called <em>Reseller Sales</em>.&#160; Now locate the measure called <em>Reseller Sales Amount</em> and select it.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Cube in Design with Reseller Sales Amount selected" border="0" alt="Cube in Design with Reseller Sales Amount selected" src="http://blog.hoegaerden.be/wp-content/uploads/image158.png" width="373" height="289" /> </p>
<p>Now that we’ve selected one of the measures that we are retrieving in our report, have a look at the Properties window.&#160; In case it’s not open yet you can right-click the measure and select Properties.&#160; The property that we’re interested in is called <strong>FormatString</strong>.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Properties of the Reseller Sales Amount measure showing Currency as format string" border="0" alt="Properties of the Reseller Sales Amount measure showing Currency as format string" src="http://blog.hoegaerden.be/wp-content/uploads/image168.png" width="435" height="252" /> </p>
<p>The cube developer has specified that this measure should be shown as being a <strong>Currency</strong>.</p>
<p>Now that you’re in the cube, have a look at the properties for our other measure, the <em>Reseller Order Quantity</em>.&#160; This one is being formatted as <strong>#,#</strong>.</p>
<h4>The FormattedValue Field Property</h4>
<p>So why are we not seeing those formats in our report?&#160; Because by default they are not applied in an SSRS report!&#160; When dragging fields from the <strong>Report Data</strong> window onto the design area, what the BIDS is retrieving is the <strong>Value</strong> property of the field.&#160; However, there’s also a property called <strong>FormattedValue</strong>.</p>
<p><em>(You may want to make a copy of your report before applying the following changes.)</em></p>
<p>Now, change the six table cells that are showing the numbers (so including the ones showing the totals) to retrieve the FormattedValue property instead of the Value property.&#160; The expression for the totals of the <strong>Reseller Sales Amount</strong> looks like this:</p>
<pre class="code">=Sum(Fields!Reseller_Sales_Amount.FormattedValue)</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Once you’ve done that, have a look at the Preview:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Report Preview showing no numbers after retrieving the FormattedValue property" border="0" alt="Report Preview showing no numbers after retrieving the FormattedValue property" src="http://blog.hoegaerden.be/wp-content/uploads/image169.png" width="578" height="398" /> </p>
<p>That doesn’t look right, does it?&#160; We’ve lost our numbers!</p>
<p>Now hit the Refresh button: <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Refresh button in Report Preview" border="0" alt="Refresh button in Report Preview" src="http://blog.hoegaerden.be/wp-content/uploads/image172.png" width="21" height="27" /> </p>
</p>
<p>This time we’ve got some numbers:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Report Preview showing formatted numbers, and errors!" border="0" alt="Report Preview showing formatted numbers, and errors!" src="http://blog.hoegaerden.be/wp-content/uploads/image170.png" width="571" height="399" /> </p>
<p>But we’ve also got some errors for free!&#160; Looking at the Output window we get some extra details on the reason for the error.&#160; Here’s one of them:</p>
<blockquote>
<p>[rsAggregateOfNonNumericData] The Value expression for the textrun ‘Reseller_Order_Quantity1.Paragraphs[0].TextRuns[0]’ uses a numeric aggregate function on data that is not numeric.&#160; Numeric aggregate functions (Sum, Avg, StDev, Var, StDevP, and VarP) can only aggregate numeric data.</p>
</blockquote>
<p>In short, what it says is that our data is not numeric.&#160; And this poses an issue when it tries to apply the SUM() aggregate function.&#160; Right, as our data now contains formatting, it became a string instead of a number, and strings can’t be added together using SUM().</p>
<p>So that’s not a good way to apply the formatting, not in this case anyway.&#160; Luckily there’s another method to do that.</p>
<p>But first, undo those last changes and replace the FormattedValue with the Value property.</p>
<p><em>(Or switch back to the original report if you took a copy earlier.)</em></p>
<h4>The Cell Properties</h4>
<p>What exactly is our MDX query doing?&#160; I’m taking a closer look at it by taking it from the Dataset Properties window and pasting it into a MDX query window in the Management Studio:</p>
<pre class="code"><span style="color: blue">SELECT
NON EMPTY </span>{ [Measures].[Reseller Sales Amount], [Measures].[Reseller Order Quantity] }
<span style="color: blue">ON COLUMNS</span>,
<span style="color: blue">NON EMPTY </span>{ ([Geography].[Geography].[Postal Code].<span style="color: maroon">ALLMEMBERS </span>) }
<span style="color: blue">DIMENSION PROPERTIES MEMBER_CAPTION</span>, <span style="color: blue">MEMBER_UNIQUE_NAME
ON ROWS
FROM </span>[Adventure Works]
<span style="color: blue">CELL PROPERTIES VALUE</span>, <span style="color: blue">BACK_COLOR</span>, <span style="color: blue">FORE_COLOR</span>, <span style="color: blue">FORMATTED_VALUE</span>,
<span style="color: blue">FORMAT_STRING</span>, <span style="color: blue">FONT_NAME</span>, <span style="color: blue">FONT_SIZE</span>, <span style="color: blue">FONT_FLAGS</span></pre>
<p>Besides retrieving the requested measures and dimension attributes, it’s retrieving several <a title="BOL 2008: Using Cell Properties (MDX)" href="http://msdn.microsoft.com/en-us/library/ms145573.aspx">Cell Properties</a>, including FORMATTED_VALUE and FORMAT_STRING.&#160; I believe that the first one rings a bell by now.&#160; What we’re going to do is to retrieve the second one and apply it as Format property for our numeric table cells.</p>
<p>In the report’s Design, select one of the table cells containing a number.&#160; In the Properties window, one of the properties is called Format.&#160; Click to select it, then in the dropdown choose Expression….&#160; For each of the six numeric cells, create an expression similar to the following:</p>
<pre class="code">=Fields!Reseller_Order_Quantity(<span style="color: #a31515">&quot;FORMAT_STRING&quot;</span>)</pre>
<p>The example above tells the BIDS to retrieve the FORMAT_STRING cell property from the Reseller_Order_Quantity field.</p>
<p><strong>Tip:</strong> you don’t need to open up the Expression builder for each of the six cells.&#160; You can just copy/paste the string from the Format field.&#160; Just ensure that you’re retrieving the format from the same field as the one that the cell is displaying.</p>
<p>Now let’s have a look at the Preview again:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Format is working for the quantity amounts but not for Currency!" border="0" alt="Format is working for the quantity amounts but not for Currency!" src="http://blog.hoegaerden.be/wp-content/uploads/image171.png" width="577" height="400" /> </p>
<p>Hmm,&#160; the quantities are fine now, but the currencies are not!&#160; So, let’s try out yet another method for those cells.</p>
<p>For the three cells containing a currency measure, remove the Format property – it’s not working anyway!</p>
<p>Next, change the expression that’s retrieving the Value property to something similar as this one:</p>
<pre class="code">=Format(Sum(Fields!Reseller_Sales_Amount.Value),
    Fields!Reseller_Sales_Amount(<span style="color: #a31515">&quot;FORMAT_STRING&quot;</span>))</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>This expression applies the value of the FORMAT_STRING property using the Format() function.&#160; In this particular case it’s the expression used to produce the Reseller Sales Amount total.</p>
<p>Having modified all three currency cells, here’s another Preview look:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image164.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Both Currency and regular numeric cells are showing formatted values!" border="0" alt="Both Currency and regular numeric cells are showing formatted values!" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb46.png" width="677" height="382" /></a> </p>
<p>That certainly looks better doesn’t it?!</p>
<p>Okay, to conclude, let’s activate drilldown by setting the subgroup levels to a collapsed state by default.</p>
<p>I will not go into full detail on this.&#160; To start, make sure that the cells that are going to contain the +/- toggle have gotten a decent name, such as txtCountry for the cell that shows the Country name.&#160; Then edit the properties of the subgroups by setting <strong>Visibility</strong> to <strong>Hide</strong>.&#160; Also, activate the <strong>Display can be toggled by this report item</strong> checkbox and select the textbox showing the label one level higher.&#160; Shown below is how to configure the group on State_Province.</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image165.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Group Properties showing how to activate drilldown" border="0" alt="Group Properties showing how to activate drilldown" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb47.png" width="670" height="508" /></a> </p>
<p>&#160;</p>
<p>Let’s have another look at the report Preview:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image166.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Fully working drilldown report" border="0" alt="Fully working drilldown report" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb48.png" width="677" height="244" /></a> </p>
<p>By default all nodes were collapsed.&#160; I’ve expanded a couple of them just to show that it’s all working.</p>
<h4>The InitialToggleState Property</h4>
<p>Okay, I will not let you go just yet.&#160; To really conclude I’ll let you in on a little feature related to the drilldown.&#160; Open up the group properties for the State_Province group and set the initial visibility to <strong>Show</strong> (leave the “Display can be toggled by this report item” checked!).&#160; Then checkout Preview:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image167.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Visibility toggle is broken!" border="0" alt="Visibility toggle is broken!" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb49.png" width="677" height="167" /></a> </p>
<p>Wow, that’s weird, the country level is expanded and yet there’s a plus icon in front of the country’s name.&#160; Clicking it will collapse the states and change the icon to minus.&#160; If that isn’t mixed up then I don’t know what is!</p>
<p>Well, the solution to this problem is simple.&#160; Select the textbox showing the country name and locate the <strong>InitialToggleState</strong> property.&#160; By default this is set to <em>False</em>, which means collapsed or in other words, False shows the plus icon.&#160; Change it to <em>True</em> and now your initial state icon will be a minus! </p>
<h2>Conclusion</h2>
<p>With this article I believe to have shown you how to get started with reporting off an OLAP cube while throwing in a couple of tips in the process.</p>
<p>Have a look at another article that I wrote earlier, it explains an issue which you may run into when taking OLAP reporting a step further: <a title="SSRS and MDX: Detecting Missing Fields" href="http://blog.hoegaerden.be/2009/07/06/ssrs-and-mdx-detecting-missing-fields/">SSRS and MDX: Detecting Missing Fields</a></p>
<p>Happy Reporting!</p>
<p>Valentino.</p>
<p><strong>References</strong></p>
<p><a title="The Basic MDX Query (MDX)" href="http://msdn.microsoft.com/en-us/library/ms144785.aspx" target="_blank">BOL 2008: The Basic MDX Query</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms145573.aspx">BOL 2008: Using Cell Properties (MDX)</a></p>
<p><a title="Retrieving Cell Properties" href="http://www.artisconsulting.com/blogs/greggalloway/Lists/Posts/Post.aspx?ID=10" target="_blank">MDX: Retrieving Cell Properties</a> by Greg Galloway</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2010%2F01%2F24%2Fyour-first-olap-report%2F&amp;title=Your%20First%20OLAP%20Report" id="wpa2a_18"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2010/01/24/your-first-olap-report/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SSMS Showing Incorrect Version Numbers In Object Explorer</title>
		<link>http://blog.hoegaerden.be/2010/01/10/ssms-showing-incorrect-version-numbers-in-object-explorer/</link>
		<comments>http://blog.hoegaerden.be/2010/01/10/ssms-showing-incorrect-version-numbers-in-object-explorer/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 23:21:23 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Management Studio]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[Integration Services 2008]]></category>
		<category><![CDATA[Reporting Services 2008]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SSIS]]></category>
		<category><![CDATA[SSMS]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/01/10/ssms-showing-incorrect-version-numbers-in-object-explorer/</guid>
		<description><![CDATA[Ever since I upgraded to SQL Server 2008 Service Pack 1 I noticed that the Management Studio was reporting incorrect version numbers when connected to Integration or Reporting Services.&#160; This incorrect version number is located to the right of the server instance in the Object Explorer. As usual, a picture says so much more than [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since I upgraded to SQL Server 2008 Service Pack 1 I noticed that the Management Studio was reporting incorrect version numbers when connected to Integration or Reporting Services.&#160; This incorrect version number is located to the right of the server instance in the Object Explorer.</p>
<p>As usual, a picture says so much more than … :</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Object Explorer showing wrong version numbers" border="0" alt="Object Explorer showing wrong version numbers" src="http://blog.hoegaerden.be/wp-content/uploads/image139.png" width="436" height="116" /> </p>
<p>As I have <a title="10.0.2531.0" href="http://blog.hoegaerden.be/2009/04/12/10025310/" target="_blank">posted earlier</a>, 10.0.2531 is the version number for SP1, while 10.0.1600 is the original RTM version number.</p>
<p>I never really spent time looking for an answer to this.&#160; It was obviously a bug but I could live with it and someone else would probably already have filed it as being a bug.&#160; So recently I came across <a title="SSIS 2008 - Beware of incorrect version stamp in SSMS" href="http://www.ssistalk.com/2010/01/04/ssis-2008-beware-of-incorrect-version-stamp-in-ssms/" target="_blank">a post by Phil Brammer</a> that mentioned this issue.&#160; This post got a comment from <a title="SSIS Team Blog - A blog about SQL Server Integration Services (SSIS) from a developer on the team." href="http://blogs.msdn.com/mattm/" target="_blank">Matt Masson</a>, a developer on the SSIS team.&#160; Have a look at the comment but in short: the version numbers that are being shown in the Object Explorer are actually the version numbers of the service’s .exe file!&#160; And SSMS is now showing the wrong number because these files didn’t get an update in SP1.</p>
<p>After a little search I found the <a title="Incorrect Version (build) number in SSMS with SSRS and SSIS" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=422562&amp;wa=wsignin1.0" target="_blank">bug report on Microsoft Connect</a>, reported on March 11, 2009, by <a title="Dan English&#39;s BI Blog" href="http://denglishbi.spaces.live.com/" target="_blank">Dan English</a>.&#160; Its status is Fixed but it seems that it isn’t.&#160; At least, looking at the comments, <a title="Cumulative Update Package 5 for SQL Server 2008 Service Pack 1" href="http://support.microsoft.com/kb/975977/LN/" target="_blank">CU5 (Cumulative Update) for SQL Server 2008 SP1</a> is still showing the problem.&#160; So I guess you could go over to the Connect page and click on that Yes button if you’re interested in seeing this fixed.&#160; After all, it could be quite misleading to novice DB guys and gals…</p>
<p>On this same subject, there’s another <a title="Reporting Services: What’s my version?" href="http://blogs.msdn.com/psssql/archive/2009/09/30/reporting-services-what-s-my-version.aspx" target="_blank">interesting post by Adam W. Saxton</a>, a member of the Microsoft SQL Server Escalation Services Team.&#160; In this post he takes a closer look at the SQL Server 2008 Reporting Services version number after having installed CU2.</p>
<p><strong>Conclusion:</strong> if you need to find out what version your server is running, do not rely on the version numbers that you see in the Object Explorer.&#160; As Adam explained, one way is to look at the version numbers of the files that were included in the upgrade.&#160; But that may a bit of an overkill.&#160; My favorite way, assuming that all components of the SQL Server installation have been upgraded to the same version, is to use the following query:</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">SELECT</span> @@VERSION;</pre>
</div>
<p>&#160;</p>
<p>On my machine that comes back with the following result:</p>
<blockquote>
<p>Microsoft SQL Server 2008 (SP1) &#8211; 10.0.2531.0 (Intel X86)&#160;&#160; Mar 29 2009 10:27:29&#160;&#160; Copyright (c) 1988-2008 Microsoft Corporation&#160; Developer Edition on Windows NT 5.1 &lt;X86&gt; (Build 2600: Service Pack 3) </p>
</blockquote>
<p>And remember, have fun!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2010%2F01%2F10%2Fssms-showing-incorrect-version-numbers-in-object-explorer%2F&amp;title=SSMS%20Showing%20Incorrect%20Version%20Numbers%20In%20Object%20Explorer" id="wpa2a_20"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2010/01/10/ssms-showing-incorrect-version-numbers-in-object-explorer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

