<?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>Data Inspirations</title>
	<atom:link href="http://blog.datainspirations.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.datainspirations.com</link>
	<description>Inspiring Intelligence from Information</description>
	<lastBuildDate>Thu, 02 Feb 2012 01:12:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>8 Enhancements in Integration Services 2012 for Easier Package Development</title>
		<link>http://blog.datainspirations.com/2012/01/27/8-enhancements-in-integration-services-2012-for-easier-package-development/</link>
		<comments>http://blog.datainspirations.com/2012/01/27/8-enhancements-in-integration-services-2012-for-easier-package-development/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 17:40:43 +0000</pubDate>
		<dc:creator>Stacia Misner</dc:creator>
				<category><![CDATA[Integration Services]]></category>
		<category><![CDATA[SQL Server 2012]]></category>
		<category><![CDATA[SSIS]]></category>

		<guid isPermaLink="false">http://blog.datainspirations.com/?p=706</guid>
		<description><![CDATA[The upcoming release of SQL Server 2012 includes a major overhaul for Integration Services (SSIS). I write about the changes in SSIS, big and small, in Introducing Microsoft SQL Server 2012 (Microsoft Press, 2012) which will be available in March as a free download. Meanwhile, if you really can&#8217;t wait that long, you can get [...]]]></description>
			<content:encoded><![CDATA[<p>The upcoming release of SQL Server 2012 includes a major overhaul for Integration Services (SSIS). I write about the changes in SSIS, big and small, in <a href="http://blogs.msdn.com/b/microsoft_press/archive/2012/01/20/release-schedule-for-our-free-introducing-microsoft-sql-server-2012-ebook.aspx" target="_blank">Introducing Microsoft SQL Server 2012 (Microsoft Press, 2012) </a>which will be available in March as a free download. Meanwhile, if you really can&#8217;t wait that long, you can get a sneak preview of a few chapters beginning February 1.</p>
<p>When writing a book like this which focuses on all the new stuff, it&#8217;s easy to get caught up in minutiae. As I begin to wind down the writing process for this book, I thought it would be interesting to step back and consider which enhancements I thought were particularly helpful for the package development process. There are certainly other enhancements that are helpful too, but the following list includes the ones that are special favorites of mine because they address problems that I encounter most often during my own package development or when teaching students about SSIS.</p>
<p>In no particular order, here is my list:</p>
<ol>
<li><strong>Interface overhaul</strong>. Business Intelligence Development Studio (BIDS) is now SQL Server Data Tools (SSDT), but that&#8217;s not the important part. Inside SSDT, the Toolbox window now includes a Favorites folder into which you can place components that you use regularly. I find that people can spend a lot of time hunting through the list of available components, so this feature can really help you out when there&#8217;s only a handful of components that you use in every package. There are several other changes to the interface, such as zoom control, and icons to specify whether a component succeeded or failed during package execution that improve the development experience as well.</li>
<li><strong>Shared Connection Managers</strong>. The idea of building something once for reuse many times is not new, and yet until now you&#8217;ve had to add the same connection managers to package after package, which turns into a rather tedious task if a change was required to each package&#8217;s connection manager. Now you can set up a connection manager once and reference it in multiple packages. As an added bonus when you use a Cache Connection Manager that you share between a parent and child package, the two packages share the same cache which optimizes performance for lookups against the same source in both packages.</li>
<li><strong>Undo and Redo</strong>. How many times have you made a change to a package and then instantly regretted it? I bet it&#8217;s happened at least once! Fortunately, the Undo button is now enabled so you can reverse that change, and the Redo button is available also in case you change your mind afterwards.</li>
<li><strong>Resolve References Editor</strong>. Managing metadata in the data flow pipeline is a concept with which many beginners struggle, especially when they make a change early in the data flow that has a ripple effect across the downstream components and causes metadata errors.  Now SSIS includes a Resolve References Editor that you can use to quickly resolve the mapping of input and output columns between components. You can use it to check that columns are mapped to one another properly, and also to see which columns remain unmapped.</li>
<li><strong>Variable scope</strong>. Here&#8217;s another commonly encountered problem. How many times have you added a variable only to realize later that you inadvertently assigned its scope to a task rather than to the package? Your only option was to delete the variable and add a new one while taking care to set the scope correctly. The new SSIS creates new variables at the package scope by default, and allows you to move an existing variable to a different scope.</li>
<li><strong>Left() function</strong>. In previous versions, you can use the Right() function or the Substring() function to work with portions of  a string, but there was no Left() function until the SQL Server 2012 release. Hooray!</li>
<li><strong>ReplaceNull() function</strong>. A very common task in data warehousing is to replace NULL values with some value. This new function just simplifies that task.</li>
<li><strong>Project deployment model and parameters</strong>.Working with SSIS projects and deployment is a completely new way of setting up packages to work in a new environment in SQL Server 2012, whether test or production. When you combine this deployment model with the use of parameters, you use parameters instead of configuration files to set run-time values for expressions. Most people didn&#8217;t understand what to do with configuration files, so this will be a welcome change indeed for that group. Even if you did work successfully with configuration files, you will likely still find it easier to set up parameters than configuration files.</li>
</ol>
<p>You can download the upcoming ebook to get more details about the items in my list above. Specifically, Chapter 6 covers Integration Services and is available now in the <a href="http://blogs.msdn.com/b/microsoft_press/archive/2011/10/11/free-ebook-introducing-microsoft-sql-server-code-name-denali-draft-preview.aspx" target="_blank">first draft of the ebook</a>. And come back to visit this blog often &#8211; I&#8217;ll be providing more details in the coming weeks about each of these items that space did not permit me to include in the ebook.</p>
<p>Meanwhile, you might also like these resources about SSIS and the upcoming release:</p>
<ul>
<li>The SSIS product development team provides <a href="http://blogs.msdn.com/b/mattm/" target="_blank">posts</a> from time to time to elaborate on various aspects of the product. You can use the Denali tag on the blog site to focus on the the new features of 2012.</li>
<li>Jamie Thomson has a <a href="http://sqlblog.com/blogs/jamie_thomson/archive/2011/07/12/ssis-enhancements-in-denali-ctp3.aspx" target="_blank">comprehensive list of changes with screen shots</a>, which after all are worth more than a thousand words!</li>
<li>Jamie also posted <a href=" http://sqlblog.com/blogs/jamie_thomson/archive/2011/07/16/ssis-logging-in-denali.aspx" target="_blank">an excellent walk-through of the level of detail that package execution can log in the SSIS catalog</a>.</li>
<li>Last, but not least, Jamie has published <a href="http://sqlblog.com/blogs/jamie_thomson/archive/2010/12/09/introducing-ssis-reporting-pack-for-sql-server-code-named-denali.aspx" target="_blank">a reporting pack</a> that helps you monitor logging in the SSIS catalog.</li>
</ul>
<p>I think my list of favorite enhancements is heavily biased by my experiences this week working with a new SSIS 2008 r2 developer. Perhaps you have a different set of favorites. If so, share your thoughts! Which SSIS features do you like best in the SQL Server 2012 release?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.datainspirations.com/2012/01/27/8-enhancements-in-integration-services-2012-for-easier-package-development/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Why Twitter? My Top 5 Reasons to Join In #Meme15</title>
		<link>http://blog.datainspirations.com/2012/01/17/why-twitter-my-top-5-reasons-to-join-in-meme15/</link>
		<comments>http://blog.datainspirations.com/2012/01/17/why-twitter-my-top-5-reasons-to-join-in-meme15/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 07:03:41 +0000</pubDate>
		<dc:creator>Stacia Misner</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.datainspirations.com/?p=665</guid>
		<description><![CDATA[When I first heard about Twitter, I had zero interest. I&#8217;m not exactly known for being succinct, so how could I possibly say anything meaningful in 140 characters or less? More importantly, who would care? &#160; Then one day I received an email explaining that I had been mentioned by SQL_Joker on Twitter and could I [...]]]></description>
			<content:encoded><![CDATA[<div><a href="http://blog.datainspirations.com/wp-content/uploads/2012/01/meme15new.png"><img class="alignleft size-full wp-image-695" style="padding: 10px;" title="meme15new" src="http://blog.datainspirations.com/wp-content/uploads/2012/01/meme15new.png" alt="" width="150" height="150" /></a></div>
<div>When I first heard about Twitter, I had zero interest. I&#8217;m not exactly known for being succinct, so how could I possibly say anything meaningful in 140 characters or less? More importantly, who would care?</div>
<p>&nbsp;</p>
<p>Then one day I received an email explaining that I had been mentioned by <a href="http://twitter.com/sql_joker" target="_blank">SQL_Joker</a> on Twitter and could I make some time for a phone conversation to talk about a potential business opportunity? Well, that email got my curiosity piqued about this Twitter business, so I set up an account so that I could see for myself what the fuss was all about, and the rest &#8211; as they say &#8211; is history!</p>
<div></div>
<div></div>
<div><a href="http://www.jasonstrate.com/2012/01/january-meme15-assignment/?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+StrateSql+%28Strate+SQL%29" target="_blank">This month&#8217;s #Meme15 topic</a>, hosted by Jason Strate (<a href="http://jasonstrate.com" target="_blank">blog</a>|<a href="http://twitter.com/StrateSQL" target="_blank">twitter</a>) asks the question why should the average Jane or Joe professional consider using Twitter? Based on my experiences after I first put my toe in the water, so to speak, I find Twitter to be one of my favorite ways to keep in touch with and be part of the SQL Server community. The key word there is &#8220;community.&#8221; Some even call it #SQLFamily.</div>
<div></div>
<div></div>
<div>All kinds of communities have sprung up on Twitter, some good, some not so good, so you can make of it what you will. But if you work with SQL Server and haven&#8217;t tried out Twitter, then you&#8217;re missing out on a terrific resource. Here are my top 5 reasons why you should consider <a href="http://twitter.com" target="_blank">signing up for Twitter</a> and joining us:</div>
<ol>
<li><strong>Get help with a problem</strong>. Whether you&#8217;re independent like me, working in a small shop, or out of resources in a big organization, there are people out there who might be able to help. Sometimes weird things happen and you need a fresh perspective for troubleshooting. Or you&#8217;ve been asked to start working with a different aspect of SQL Server and need a nudge in the right direction. With SQL Server professionals around the globe, someone out there is probably able to help. Don&#8217;t worry if no one knows who you are and isn&#8217;t following you &#8211; that will come with time. All you need to do is compose a tweet and add a hashtag at the end of your request &#8211; like #sqlhelp, #ssashelp, #ssishelp, or #ssrshelp. If you need more that 140 characters, then break your tweet into 2 parts and add 1/2 and 2/2 to each part. Before you tweet, you can use the search feature in Twitter to see tweets using these hashtags and learn what kinds of questions get answered. Obviously, it&#8217;s not the best way to get help for complex problems.</li>
<li><strong>Learn new things</strong>. Technology keeps changing and it can be challenging to stay current. As you learn who&#8217;s who in the SQL Server community, you can follow them to get breaking news, or thoughts about trends, or resources of interest. Don&#8217;t know who to follow? Start by watching who answers questions for the #sqlhelp and other hashtags, click the name, and click the Follow button. If you like what they tweet, do nothing but continue to watch the tweets. If you don&#8217;t like what they tweet, you can always Unfollow later. If you explore Twitter more deeply, you can also see who a person follows and who follows them. You might see some names you recognize as conference speakers, bloggers, and authors of magazine articles and books. Cast a wide net.</li>
<li><strong>Develop friendships with people who share common interests</strong>. Those of us in the SQL Server community have SQL Server in common. Often, the way we met one another was at conferences and that&#8217;s the only time we interacted from year to year. But with Twitter, we can continue the conversation. And with more conversation, the more we get to know one another and the friendships develop. And for those who can&#8217;t get to a conference, they can participate vicariously as many of us tweet interesting things that we hear and see. I&#8217;ve had Twitter exchanges with many people long before I met them, and some whom I&#8217;ve never met. So don&#8217;t feel like you have to know someone personally before you engage. Just be polite and friendly. Ask questions or offer up something you&#8217;ve learned. Before long, if you play nicely, you&#8217;ll be amazed at how you&#8217;ve been assimilated into the family.</li>
<li><strong>Have a laugh</strong>. We work hard and take our jobs seriously. Well, most of us do! But, seriously, we need a break from time to time, even if just for a few minutes. Every now and then, someone will come up with a topic and people begin to riff on that. You&#8217;ll see things like movies or books with names adapted to something meaningful and humorous only to those in the SQL Server community. You&#8217;ll just have to keep your eyes peeled to see what I mean.</li>
<li><strong>Work the network</strong>. As you get to know people on Twitter, you&#8217;ll find that you can get help in other ways besides the technical stuff. Maybe you need to find a job, or maybe you know of a job opening at your company. Twitter is a great way to share the need and someone might be able to help. I&#8217;ve heard lots of great stories of people getting connected in this way. Of course, having relationships built first is important. But this network of ours is not just about jobs. If you&#8217;re traveling some place new, or thinking about buying some new gadget, or need inspiration for a new way to fix something for dinner, someone in the community has an opinion that you might find useful.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.datainspirations.com/2012/01/17/why-twitter-my-top-5-reasons-to-join-in-meme15/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>16 Resources for Improving Your MDX Skills</title>
		<link>http://blog.datainspirations.com/2012/01/13/16-resources-for-improving-your-mdx-skills/</link>
		<comments>http://blog.datainspirations.com/2012/01/13/16-resources-for-improving-your-mdx-skills/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 10:17:13 +0000</pubDate>
		<dc:creator>Stacia Misner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.datainspirations.com/?p=650</guid>
		<description><![CDATA[If you&#8217;ve been following my recent series on MDX, which began with Location, Location, Location, you have learned some important concepts, but this series was merely an introduction and there is so much more to learn. To help you continue building your skills, here are a variety of resources that I recommend that you peruse. [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been following my recent series on MDX, which began with <a title="SQLU MDX Week: Location, Location, Location" href="http://blog.datainspirations.com/2011/12/13/sqlu-mdx-week-location-location-location/" target="_blank">Location, Location, Location</a>, you have learned some important concepts, but this series was merely an introduction and there is so much more to learn. To help you continue building your skills, here are a variety of resources that I recommend that you peruse.</p>
<h3>Books</h3>
<ul>
<li><em><a href="http://www.amazon.com/Microsoft®-Server®-2008-Step-Microsoft/dp/0735626189/ref=sr_1_1?ie=UTF8&amp;qid=1326443512&amp;sr=8-1" target="_blank">SQL Server 2008 MDX Step by Step</a></em>, Bryan C. Smith, C. Ryan Clay, Hitachi Consulting (Microsoft Press, 2009). This book is useful for beginners, and leads you through the key concepts of MDX as the name implies&#8230;step by step. Although it&#8217;s written for SQL Server 2008, you will find it useful for SQL Server 2008 R2 as well and, although I haven&#8217;t tested it, it should work for SQL Server 2012.</li>
<li><em><a href="http://www.amazon.com/Microsoft-Server-Analysis-Services-Cookbook/dp/1849681309/ref=sr_1_1?s=books&amp;ie=UTF8&amp;qid=1326444296&amp;sr=1-1" target="_blank">MDX with SQL Server 2008 R2 Analysis Services Cookbook</a></em>, Tomislave Piasevoli (Packt Publishing, 2011). I really like this book, as you might surmise from <a title="Book Review: MDX with Microsoft SQL Server 2008 R2 Analysis Services Cookbook" href="http://blog.datainspirations.com/2011/10/21/book-review-mdx-with-microsoft-sql-server-2008-r2-analysis-services-cookbook/" target="_blank">my review</a>, and picked up a few tips myself. However, you&#8217;re not going to start learning MDX with this book. I recommend that you first read the Step by Step or some of the online resources first to get the most value from it.</li>
<li><em><a href="http://www.amazon.com/MDX-Solutions-Microsoft-Analysis-Services/dp/0471748080/ref=sr_1_1?s=books&amp;ie=UTF8&amp;qid=1326443745&amp;sr=1-1" target="_blank">MDX Solutions, 2<sup>nd</sup> edition</a>.</em> George Spofford, Sivakumar Harinath, Christopher Webb, and Dylan Hai Huang (Wiley, 2006). Although this book is focused on SQL Server 2005, much of it still applies to 2008 and later versions as the language remains largely intact. However, I must say this is not a book for beginners. There is lots of useful information here, but you will find it more useful if you already have a good grasp of the basics.</li>
<li><em><a href="http://www.amazon.com/Practical-MDX-Queries-Microsoft-Analysis/dp/0071713360/ref=sr_1_1?s=books&amp;ie=UTF8&amp;qid=1326444132&amp;sr=1-1" target="_blank">Practical MDX Queries for Microsoft SQL Server Analysis Services 2008</a></em>, Art Tennick (McGraw-Hill, 2010). I haven&#8217;t read this book yet, but it&#8217;s in my queue to read this year. If you&#8217;ve read it, I invite you to add a comment to this post with your impression.</li>
</ul>
<h3> Online Resources</h3>
<ul>
<li><a href="http://www.sqlservercentral.com/articles/Stairway+Series/71867/" target="_blank">Stairway to MDX Series</a>, I have long recommended Bill Pearson&#8217;s (<a href="http://twitter.com/Bill_Pearson" target="_blank">@Bill_Pearson</a>) online writings, such as <a href="http://www.databasejournal.com/features/mssql/article.php/1495511/MDX-at-First-Glance-Introduction-to-SQL-Server-MDX-Essentials.htm" target="_blank">MDX Essentials</a> at Database Journal, and of course must heartily recommend his latest endeavor at SQL Server Central.</li>
<li><a href="http://www.mosha.com/msolap/mdxstudio.htm" target="_blank">MDX Studio</a>. This resource is not one designed to teach you MDX, but I include it as a tool that you can use to improve your MDX as it is a tool that you can use to identify problems  in your query and to capture statistics for your query if you&#8217;re attempting to improve performance. Mosha, the developer of this tool, also developed <a href="http://mdx.mosha.com" target="_blank">an online version for formatting and analysis</a>.</li>
</ul>
<h3>Blogs</h3>
<ul>
<li><a class="zem_slink" title="Mosha Pasumansky" href="http://en.wikipedia.org/wiki/Mosha_Pasumansky" rel="wikipedia" target="_blank">Mosha Pasumansky</a> is one of the architects responsible for the MDX language, so what better resource could you ask for? He&#8217;s no longer at Microsoft, but fortunately his legacy persists at SQLBlog.com with <a href="http://sqlblog.com/blogs/mosha/default.aspx" target="_blank">many posts dedicated to providing insights into MDX</a>.</li>
<li>Chris Webb (<a href="http://twitter.com/Technitrain" target="_blank">@Technitrain</a>) is a coauthor of the second edition of the MDX Solutions mentioned above and writes frequently about  <a href="http://cwebbbi.wordpress.com/category/mdx/" target="_blank">MDX</a>. He has some very creative ideas that I have found useful in some of the more bleeding edge projects I have worked on.</li>
<li>Another terrific <a href="http://sqlblog.com/blogs/marco_russo/archive/tags/MDX/default.aspx" target="_blank">MDX</a> online resource is Marco Russo (<a href="http://twitter.com/marcorus" target="_blank">@MarcoRus</a>). Marco and Chris Webb (along with Alberto Ferrari) co-authored <a href="http://www.amazon.com/Expert-Development-Microsoft-Analysis-Services/dp/1847197221/ref=sr_1_1?ie=UTF8&amp;qid=1326446985&amp;sr=8-1" target="_blank">Expert Cube Development with Microsoft SQL Server 2008 Analysis Services</a> which I recommend if you want to learn more about developing the cubes that we use as a source for MDX queries.</li>
<li>Boyan Penev (<a href="http://twitter.com/boyanpenev" target="_blank">@BoyanPenev</a>) also writes on <a href="http://www.bp-msbi.com/category/10-ssas/" target="_blank">SSAS topics</a> that you might find helpful for improving your MDX skills</li>
<li>Greg Galloway has some interesting studies on MDX at his <a href="http://www.artisconsulting.com/blogs/greggalloway/Lists/Categories/Category.aspx?Name=MDX" target="_blank">blog</a>.</li>
<li>SSAS-info, run by Vidas Matelis (<a href="http://twitter.com/VidasM">@VidasM</a>) is a great aggregation site that includes <a href="http://ssas-info.com/analysis-services-faq/27-mdx" target="_blank">MDX topics</a>.</li>
<li>And of course, I have my own series which will expand over time, so keep checking back here for <a href="http://blog.datainspirations.com/tag/mdx/" target="_blank">everything I write on MDX</a>.</li>
</ul>
<h3>Whitepapers/Best Practices</h3>
<ul>
<li><a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=661" target="_blank">Identifying and Resolving MDX Query Performance Bottlenecks</a>. MDX performance is partly dependent on the choices you make when constructing the query and partly dependent on the cube structure. This whitepaper explains how to determine where to focus your attention for resolving query performance issues.</li>
<li><a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=3be0488d-e7aa-4078-a050-ae39912d2e43&amp;displaylang=en" target="_blank">Analysis Services 2008 Performance Guide</a>. Here you&#8217;ll find some good information about avoiding MDX functions that cause performance problems. You can use this whitepaper in conjunction with the performance bottleneck whitepaper to ferret out the problems you might be experiencing with slow queries.</li>
<li><a href="http://msdn.microsoft.com/en-US/library/cc966527%28v=technet.10%29.aspx" target="_blank">Analysis Services Query Performance Top 10 Best Practices</a>. As you build your MDX skills, it&#8217;s a very good idea to keep best practices in mind. This is  a nice quick reference to have handy.</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=0da8d4bc-5ef5-439b-8dc1-28ef89464892" alt="" /></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.datainspirations.com/2012/01/13/16-resources-for-improving-your-mdx-skills/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MDX: Adding a Simple Calculation to a Query</title>
		<link>http://blog.datainspirations.com/2012/01/03/mdx-adding-a-simple-calculation-to-a-query/</link>
		<comments>http://blog.datainspirations.com/2012/01/03/mdx-adding-a-simple-calculation-to-a-query/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 09:21:45 +0000</pubDate>
		<dc:creator>Stacia Misner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.datainspirations.com/?p=639</guid>
		<description><![CDATA[After an intermission for the holidays, I&#8217;m resuming my series of posts that provide an introduction to MDX. This series began with Location, Location, Location, and continued through A Gentle Introduction to Sets. At this point, you should have a good idea of the basic structure of a query using objects in an Analysis Services [...]]]></description>
			<content:encoded><![CDATA[<p>After an intermission for the holidays, I&#8217;m resuming my series of posts that provide an introduction to MDX. This series began with <a title="SQLU MDX Week: Location, Location, Location" href="http://blog.datainspirations.com/2011/12/13/sqlu-mdx-week-location-location-location/" target="_blank">Location, Location, Location</a>, and continued through <a title="SQLU MDX Week: A Gentle Introduction to Sets" href="http://blog.datainspirations.com/2011/12/16/sqlu-mdx-week-an-introduction-to-sets/" target="_blank">A Gentle Introduction to Sets</a>. At this point, you should have a good idea of the basic structure of a query using objects in an Analysis Services cube. In this post, I&#8217;m going to explain how you can expand your options by adding objects at query time.</p>
<p>You might do this during cube development to test out calculation syntax before adding it to the cube, or you might do this only when you need to run a one-time query to answer a specific question or test the cube. You can even use this technique for Reporting Services reports or with  other tools. But I have to recommend that, wherever possible, you should put calculations inside a cube which would render moot what I&#8217;m about to show you.  Why? So you don&#8217;t have to reinvent the wheel each time you need a calculation. One of the reasons we build cubes is to centralize business logic, which includes calculations. That said, some calculations can&#8217;t go in the cube. Whatever your reason, there will likely come a time that you&#8217;ll need a calculation added to your query, so the point of this post is to prepare you for that time.</p>
<p>We&#8217;ll start with an analogy in Excel, using a percent of total calculation as shown below. The formula consists of a numerator to get the sales amount on the current row and a denominator that references the total sales amount in cell B2. We use the terms relative reference and absolute reference to describe the values in the numerator and the denominator, respectively. So for Road-250 Black, 44 on row 4, we have a formula =B4/$B$2, where B4 is a relative reference and $B$2 is the absolute reference. As we paste the formula into rows 2, 3, and 5, the formula changes to =B2/$B$2, =B3/$B$2, and B5/$B$2.</p>
<p style="text-align: center;"><a href="http://blog.datainspirations.com/wp-content/uploads/2012/01/excel-03.gif"><img class="size-medium wp-image-640 aligncenter" title="excel-03" src="http://blog.datainspirations.com/wp-content/uploads/2012/01/excel-03-300x117.gif" alt="" width="300" height="117" /></a></p>
<p>We can get similar behavior in an MDX query by using tuples. I can create one tuple as an expression (the term we use in Analysis Services that corresponds to a formula in Excel) for the numerator, and a second tuple as an expression for the numerator. Let&#8217;s create a query that has a calculation for the numerator and denominator separately, and then a third calculation for the final calculation so that we can see the results independently.</p>
<p>First, I like to create the query with placeholders, just to get the query structure straight before I introduce anything else that might compromise the query as I add complexity. Not that this example is complex, but it&#8217;s a good habit to develop. Start simple, and build up from there. It&#8217;s too easy to mess yourself up with a stray comma or parenthesis. Note that we add in each expression in a WITH clause that precedes the SELECT statement, and that we add the expressions as measures. Then we can use them just like a measure that comes from the cube in the SELECT statement.</p>
<pre>WITH
MEMBER [Measures].[Numerator] AS NULL
MEMBER [Measures].[Denominator] AS NULL
MEMBER [Measures].[Pct of Total] AS NULL
SELECT
{[Measures].[Sales Amount],[Measures].[Numerator],[Measures].[Denominator],[Measures].[Pct of Total]}
ON COLUMNS,
[Product].[Category].Members ON ROWS
FROM [Adventure Works]
</pre>
<p>&nbsp;</p>
<p><a href="http://blog.datainspirations.com/wp-content/uploads/2012/01/mdx-091.gif"><img class="aligncenter size-full wp-image-643" title="mdx-09" src="http://blog.datainspirations.com/wp-content/uploads/2012/01/mdx-091.gif" alt="" width="387" height="118" /></a></p>
<p>Now let&#8217;s update the numerator expression by replacing NULL with [Measures].[Sales Amount]. You can see below that the query result simply repeats the sales amount value from the first column in the second column. Let&#8217;s review what we know about tuples from <a title="SQLU MDX Week: Location, Location, Location" href="http://blog.datainspirations.com/2011/12/13/sqlu-mdx-week-location-location-location/" target="_blank">Location, Location, Location</a>. When the query resolves the tuple for the second column, the current measure &#8211; [Measures].[Numerator] &#8211; doesn&#8217;t really exist in the cube, but its expression redirects to [Measures].[Sales Amount] which then gets combined with the category member on each row to produce a tuple which in turn resolves as a value retrieved from the cube. Just like the tuples for each value in the first column. This tuple is like the relative reference we saw in the Excel example &#8211; Sales Amount varies according to the row.</p>
<p><a href="http://blog.datainspirations.com/wp-content/uploads/2012/01/mdx-10.gif"><img class="aligncenter size-full wp-image-644" title="mdx-10" src="http://blog.datainspirations.com/wp-content/uploads/2012/01/mdx-10.gif" alt="" width="419" height="115" /></a></p>
<p>Next let&#8217;s update the denominator expression by replacing NULL with a tuple expression: ([Measures].[Sales Amount], [Product].[Category].[All Products]). This time the query results shown below repeat the tuple value that we see at the intersection of the first column and first row. When the query resolves the tuple for the third column, both the measure in the tuple and the category member come from the expression. Thus, we get a constant value for each row in the third column. This tuple is like the absolute value in the Excel example.</p>
<p><a href="http://blog.datainspirations.com/wp-content/uploads/2012/01/mdx-12.gif"><img class="aligncenter size-full wp-image-646" title="mdx-12" src="http://blog.datainspirations.com/wp-content/uploads/2012/01/mdx-12.gif" alt="" width="438" height="114" /></a></p>
<p>So let&#8217;s ponder tuple behavior in query results again for a moment. Simply put, a tuple resolves as by combining the current column member, the current row member, and whatever members are in the WHERE clause (aka the slicer). If a member on rows, on columns, or in the WHERE clause is a calculated member, then whatever member the calculated member references in the expression will be overridden in the current row, column, or slicer member. If the expression is complex &#8211; that is, composed of operations on multiple tuples &#8211; then the contents of each tuple is evaluated independently. Thus, in the percent of total calculation, we have the numerator changing dynamically as row members change but the denominator remaining constant.</p>
<p>Putting the pieces together, we get the final query as shown below. Notice the FORMAT_STRING property added to the Pct of Total expression to get a percentage format. It&#8217;s not necessary for Numerator or Denominator because the use of Sales Amount directly (rather than as part of a computation) results in the use of the currency format string as defined for the measure in the cube.</p>
<pre>WITH
MEMBER [Measures].[Numerator] AS [Measures].[Sales Amount]
MEMBER [Measures].[Denominator] AS ([Measures].[Sales Amount], [Product].[Category].[All Products])
MEMBER [Measures].[Pct of Total] AS [Measures].[Numerator] / [Measures].[Denominator], FORMAT_STRING='Percent'
SELECT
{[Measures].[Sales Amount],[Measures].[Numerator],[Measures].[Denominator],[Measures].[Pct of Total]}
ON COLUMNS,
[Product].[Category].Members ON ROWS
FROM [Adventure Works]</pre>
<div><a href="http://blog.datainspirations.com/wp-content/uploads/2012/01/mdx-11.gif"><img class="aligncenter size-full wp-image-645" title="mdx-11" src="http://blog.datainspirations.com/wp-content/uploads/2012/01/mdx-11.gif" alt="" width="439" height="114" /></a></div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.datainspirations.com/2012/01/03/mdx-adding-a-simple-calculation-to-a-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MDX &#8211; More to Come!</title>
		<link>http://blog.datainspirations.com/2011/12/26/mdx-more-to-come/</link>
		<comments>http://blog.datainspirations.com/2011/12/26/mdx-more-to-come/#comments</comments>
		<pubDate>Mon, 26 Dec 2011 22:44:40 +0000</pubDate>
		<dc:creator>Stacia Misner</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.datainspirations.com/?p=629</guid>
		<description><![CDATA[Although my recent series was of MDX posts, ending with A Gentle Introduction to Sets, was intended merely to be an introduction to MDX, and not a full-fledged course, I have a few more things to share with you! I had hoped I could wrap it up last week. As it turns out, I needed [...]]]></description>
			<content:encoded><![CDATA[<p>Although my recent series was of MDX posts, ending with <a title="SQLU MDX Week: A Gentle Introduction to Sets" href="http://blog.datainspirations.com/2011/12/16/sqlu-mdx-week-an-introduction-to-sets/" target="_blank">A Gentle Introduction to Sets</a>, was intended merely to be an introduction to MDX, and not a full-fledged course, I have a few more things to share with you! I had hoped I could wrap it up last week. As it turns out, I needed the entire week to finish a chapter for the <a title="Introducing Microsoft SQL Server 2012" href="http://blogs.msdn.com/b/microsoft_press/archive/2011/10/11/free-ebook-introducing-microsoft-sql-server-code-name-denali-draft-preview.aspx" target="_blank">Introducing Microsoft SQL Server 2012</a> book. </p>
<p>Compounding the delay is the fact that I&#8217;m currently in my remote Alaskan home and the Internet situation is still getting ironed out. It  has taken me over 20 minutes just to get this simple little explanation post put out there for you. (It&#8217;s PAINfully slow, but at least I have a beautiful view while I wait!) Besides, you should be doing something else as the year winds down! I promise there will be more to come. Either as soon as my Internet speeds up or when I get back to the mainland &#8211; whichever comes first!</p>
<p><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/Christmas-Morning-2011.jpg"><img src="http://blog.datainspirations.com/wp-content/uploads/2011/12/Christmas-Morning-2011-300x185.jpg" alt="" title="Christmas Morning 2011" width="300" height="185" class="aligncenter size-medium wp-image-633" /></a></p>
<p>Wishing you a very Happy New Year!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.datainspirations.com/2011/12/26/mdx-more-to-come/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLU MDX Week: A Gentle Introduction to Sets</title>
		<link>http://blog.datainspirations.com/2011/12/16/sqlu-mdx-week-an-introduction-to-sets/</link>
		<comments>http://blog.datainspirations.com/2011/12/16/sqlu-mdx-week-an-introduction-to-sets/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 12:51:15 +0000</pubDate>
		<dc:creator>Stacia Misner</dc:creator>
				<category><![CDATA[Analysis Services]]></category>
		<category><![CDATA[MDX]]></category>
		<category><![CDATA[SQL University]]></category>

		<guid isPermaLink="false">http://blog.datainspirations.com/?p=611</guid>
		<description><![CDATA[Welcome to my third post in a series of topics on MDX for SQL University. If you&#8217;re just now joining me, you should check out the first post, Location, Location, Location, and my previous post, Writing Simple Queries, to get oriented. I&#8217;m going to continue building on the concepts introduced in the earlier posts by showing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlchicken.com/sql-university" target="_blank"><img class="size-full wp-image-428 alignleft" title="SQL University" src="http://blog.datainspirations.com/wp-content/uploads/2011/05/SQL_University.png" alt="" width="175" height="200" /></a><br />
Welcome to my third post in a series of topics on MDX for <a href="http://sqlchicken.com/sql-university/" target="_blank">SQL University</a>. If you&#8217;re just now joining me, you should check out the first post, <a title="SQLU MDX Week: Location, Location, Location" href="http://blog.datainspirations.com/2011/12/13/sqlu-mdx-week-location-location-location/" target="_blank">Location, Location, Location</a>, and my previous post, <a title="SQLU MDX Week: Writing Simple Queries" href="http://blog.datainspirations.com/2011/12/14/sqlu-mdx-week-writing-simple-queries/" target="_blank">Writing Simple Queries</a>, to get oriented. I&#8217;m going to continue building on the concepts introduced in the earlier posts by showing you how to use functions to create a set to use on an axis.</p>
<p>Many times you&#8217;re interested in seeing values for all of the members of a particular attribute hierarchy. For example, in this query, we can see sales for all categories and for all years, including a grand total for categories and years and also years that have no sales.</p>
<pre>SELECT
[Date].[Calendar Year].Members
 ON COLUMNS,
[Product].[Category].Members ON ROWS
FROM [Adventure Works]
WHERE [Measures].[Sales Amount]</pre>
<p style="text-align: center;"><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-05.gif"><img class="aligncenter size-full wp-image-613" title="mdx-05" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-05.gif" alt="" width="529" height="112" /></a></p>
<p>When you use the Members function with a dimension and hierarchy, you get everything listed in the Members folder:</p>
<p style="text-align: center;"><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/members.gif"><img class="aligncenter size-full wp-image-614" title="members" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/members.gif" alt="" width="204" height="193" /></a></p>
<p>What if you don&#8217;t want the All Periods member to show up? Well, you could create a set like this {[Date].[Calendar].[CY 2005], [Date].[Calendar.[CY 2006], &#8230;} but that would be tedious, and it wouldn&#8217;t automatically include new members that get added to the dimension over time. Instead, you can use the Members function with the dimension, hierarchy, and level reference to skip over the All Periods like this:</p>
<pre>SELECT
[Date].[Calendar Year].[Calendar Year].Members
 ON COLUMNS,
[Product].[Category].Members ON ROWS
FROM [Adventure Works]
WHERE [Measures].[Sales Amount]</pre>
<p style="text-align: center;"><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-06.gif"><img class="aligncenter size-full wp-image-615" title="mdx-06" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-06.gif" alt="" width="450" height="97" /></a></p>
<p>Here we have a case of &#8220;more is less.&#8221; When we use a level reference, such as we do with the expression [Date].[Calendar Year].[Calendar Year].Members, we are providing more specific instructions to the Members function so that we can get less data. Using a level reference works with both attribute hierarchies (the ones with two levels only) and user-defined hierarchies (the ones with multiple levels and a pyramid-shaped icon).</p>
<p style="text-align: center;"><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/level-members.gif"><img class="aligncenter size-full wp-image-616" title="level-members" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/level-members.gif" alt="" width="198" height="230" /></a></p>
<p>One more little change to this query might make it better. If we don&#8217;t want to see CY 2009 and CY 2010 columns when they are empty, we add the NON EMPTY keyword in front of the set definition like this:</p>
<pre>SELECT
NON EMPTY [Date].[Calendar Year].[Calendar Year].Members
 ON COLUMNS,
[Product].[Category].Members ON ROWS
FROM [Adventure Works]
WHERE [Measures].[Sales Amount]</pre>
<p>What if we want to see the category sales broken down not only by year, but also by sales territory? We can combine sets on an axis using the CrossJoin function like this:</p>
<pre>SELECT
NON EMPTY [Date].[Calendar Year].[Calendar Year].Members
 ON COLUMNS,
NON EMPTY
CrossJoin([Product].[Category].Members,
	[Sales Territory].[Sales Territory Group].[Sales Territory Group].Members)
ON ROWS
FROM [Adventure Works]
WHERE [Measures].[Sales Amount]</pre>
<pre><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-07.gif"><img class="aligncenter size-full wp-image-619" title="mdx-07" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-07.gif" alt="" width="423" height="248" /></a></pre>
<p>The CrossJoin function takes only two arguments, but you can use that expression as one argument in a second CrossJoin function to create a grouping of three dimension hierarchies on an axis. There are several ways to get the crossjoin effect which might be easier to read when you start adding more dimension hierarchies to the mix. One is the use of a &#8220;polymorphic operator&#8221; such as an asterisk * like this:</p>
<pre>[Product].[Category].Members *
[Sales Territory].[Sales Territory Group].[Sales Territory Group].Members</pre>
<p>The other is to create a tuple set like this:</p>
<pre>([Product].[Category].Members,
[Sales Territory].[Sales Territory Group].[Sales Territory Group].Members)</pre>
<p>I know I said in a previous post that a tuple is like a coordinate to a cell, and it appears in the above example that I&#8217;m violating that rule by using sets in a tuple. But Analysis Services resolves this expression as a set of tuples by taking every member of the first set (the product category members) to create a tuple with every member of the second set (sales territory group members).  That set gets placed on the rows axis and the set of calendar year members gets placed on the columns axis, and then the tuple coordinates for each intersection of a row and a column produces a new tuple definition that generates a result, such as $709,947.20 for the pseudo-tuple (All Products, Europe, CY 2005).</p>
<p>There are many more functions that we can use to generate sets to control what we see on rows or columns. More than I can cover in this post. (In fact, there are entire books that cover this topic. In a future post, I&#8217;ll provide some recommendations.) For now, I&#8217;ll leave you with one more function to add to your repertoire. This time we want to see only those product categories and sales territory combinations that have sales greater than $1 million in CY 2008, but we want to see their sales for all years. To do this, we use the Filter function. This should satiate your desire to use a WHERE clause in your query, which I told you in my previous post does not work like a filter as it does in a T-SQL query.</p>
<pre>SELECT
NON EMPTY [Date].[Calendar Year].[Calendar Year].Members
 ON COLUMNS,
Filter(
	([Product].[Category].[Category].Members,
		[Sales Territory].[Sales Territory Group].[Sales Territory Group].Members),
	([Measures].[Sales Amount],[Date].[Calendar Year].&amp;[2008])  &gt; 1000000)
ON ROWS
FROM [Adventure Works]
WHERE [Measures].[Sales Amount]</pre>
<p><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-08.gif"><img class="aligncenter size-full wp-image-620" title="mdx-08" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-08.gif" alt="" width="520" height="98" /></a></p>
<p>The Filter function takes two arguments. The first is the set that you want to filter. And the second is a Boolean expression that determines which members will be in the set that the Filter function produces. In this case, I used a tuple expression to focus on the 2008 sales.  If I had used only Sales Amount, the filter would have produced a set of category/territory combinations having total sales for all years greater than $1 million.</p>
<p>The key concept to take away from this post is that sets go on rows and columns, and that we can control very precisely which members are in those sets by using functions and tuple sets. A very common function to use is the Members function, and it&#8217;s also common to use NON EMPTY to rid ourselves of rows or columns that contain only null values.</p>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.datainspirations.com/2011/12/16/sqlu-mdx-week-an-introduction-to-sets/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SQLU MDX Week: Writing Simple Queries</title>
		<link>http://blog.datainspirations.com/2011/12/14/sqlu-mdx-week-writing-simple-queries/</link>
		<comments>http://blog.datainspirations.com/2011/12/14/sqlu-mdx-week-writing-simple-queries/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 16:57:55 +0000</pubDate>
		<dc:creator>Stacia Misner</dc:creator>
				<category><![CDATA[Analysis Services]]></category>
		<category><![CDATA[MDX]]></category>
		<category><![CDATA[SQL University]]></category>

		<guid isPermaLink="false">http://blog.datainspirations.com/?p=601</guid>
		<description><![CDATA[This post is the second in a series of topics on MDX for SQL University. In my first post, Location, Location, Location, I introduced the tuple as a way to retrieve data from a cube with very precise instructions about what you want. In this post, I&#8217;m going to show you how to do that by [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlchicken.com/sql-university" target="_blank"><img class="size-full wp-image-428 alignleft" title="SQL University" src="http://blog.datainspirations.com/wp-content/uploads/2011/05/SQL_University.png" alt="" width="175" height="200" /></a><br />
This post is the second in a series of topics on MDX for <a href="http://sqlchicken.com/sql-university/" target="_blank">SQL University</a>. In my first post, <a title="SQLU MDX Week: Location, Location, Location" href="http://blog.datainspirations.com/2011/12/13/sqlu-mdx-week-location-location-location/" target="_blank">Location, Location, Location</a>, I introduced the tuple as a way to retrieve data from a cube with very precise instructions about what you want. In this post, I&#8217;m going to show you how to do that by writing queries. One thing that you will have to promise me as you read this post is to forget what you know about SQL queries (presuming you have some knowledge in that area). It will mess you up. If you start with a clean slate, you will have an easier time of it.</p>
<h3>Preparing the Query Environment</h3>
<p>Before I dive into writing queries, let me explain the setup. I&#8217;m using SQL Server 2008 R2 Analysis Services for these examples. You can work with earlier versions, but in some cases you will encounter date ranges that are four years earlier than the date shown in my examples. For example, instead of using Q3 2007, you would need to use Q3 2004. The measure values will remain the same. Here are links to the samples that you need to have installed:</p>
<ul>
<li style="text-align: left;">If using Microsoft SQL Server 2005, install the sample databases (AdventureWorks, AdventureWorksDW)</li>
<li style="text-align: left;">If using a later version, download the sample databases from <a href="http://msftdbprodsamples.codeplex.com/">http://msftdbprodsamples.codeplex.com/</a>, install the databases, and then follow the instructions at <a href="http://msftdbprodsamples.codeplex.com/wikipage?title=Installing%20Analysis%20Services%20Database">http://msftdbprodsamples.codeplex.com/wikipage?title=Installing%20Analysis%20Services%20Database</a> to install and deploy the Analysis Services database.</li>
</ul>
<h3>Requesting a Tuple from a Cube</h3>
<p>Okay, let&#8217;s start simple. Very, very simple. Go to SQL Server Management Studio, connect to Analysis Services, and click the MDX button on the query toolbar. An MDX query editor window will open. In the Available Databases drop-down list, select the Adventure Works database for your version of SSAS.</p>
<p>To retrieve a tuple from the cube named Adventure Works, you write a query like this:</p>
<pre>SELECT FROM [Adventure Works] 
WHERE
([Product].[Product].&amp;[359],[Date].[Date].[January 1, 2008],[Measures].[Sales Amount])</pre>
<p><span class="Apple-style-span" >Notice the way that I refer to dimension members here. I&#8217;m no longer writing a pseudo-tuple as I did in my previous post, but am now using member unique names which tells Analysis Services the dimension and  hierarchy to which the member belongs. If you leave out the dimension and hierarchy, you will still get an answer, but no guarantee that you have the right answer if it&#8217;s possible that another dimension and hierarchy contain a member of the same name. For example, what if I have a West region and a sales person with the last name of West? Analysis Services will use one or the other to construct the tuple. The only way I can control which one is to use the dimension and hierarchy name. In fact, I switched from using Mountain-200 Black, 38 to [Product].[Product].&amp;[359] because there are two products with the name Mountain-200 Black, 38 (due to Slowly Changing Dimensions) and I want the one that actually has sales for January 1, 2008. I can refer to members not only by name, but by the value in the key column &#8211; which in this case is the surrogate key for the dimension. I use an ampersand before the key value wrapped in brackets to specify that it&#8217;s a key column in the tuple rather than a member name .</span></p>
<p>Now let&#8217;s see the results of the query. Press F5 or the Execute button in the toolbar to see a single value appear in the Results pane.</p>
<p><strong><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-01.gif"><img class="aligncenter size-full wp-image-603" title="mdx-01" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-01.gif" alt="" width="154" height="52" /></a><br />
</strong></p>
<p>The WHERE clause in your query contains the tuple that you want to retrieve. It does NOT behave like a WHERE clause in a SQL query, which is why I asked you nicely to forget about that other language &#8211; at least for the duration of this post. The problem with requesting a tuple this way is that the result does not include any metadata that tells me what I&#8217;m looking at. So I can enhance this query by showing one of the members of the tuple as a column label and one of the other members of the tuple as a row label, like this:</p>
<pre>SELECT 
[Date].[Date].[January 1, 2008] ON COLUMNS,
[Product].[Product].&amp;[359] ON ROWS
FROM [Adventure Works] 
WHERE [Measures].[Sales Amount]</pre>
<p>Press F5 to see that the result of the query is the same, but now we have some more context for the value that displays.</p>
<p><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-02.gif"><img class="aligncenter size-full wp-image-604" title="mdx-02" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-02.gif" alt="" width="232" height="68" /></a></p>
<p>The way that I like to think about the query results for this example is that it works in three phases. First, Analysis Services retrieves my request for the member on columns. Second, it retrieves my request for the member on rows. Those two steps occur completely independently of one another. Third, Analysis Services looks at the intersections produced by placing member on columns and rows and adds in the WHERE clause to produce a tuple. That&#8217;s why we get the same value in the result. It doesn&#8217;t matter which member you put on columns and which member you put on rows and which you leave in the WHERE clause. Collectively, they produce a tuple.</p>
<p>You don&#8217;t have to use a WHERE clause in the query. Instead, you could put everything onto an axis &#8211; either rows or columns. Essentially, you&#8217;re moving the tuple fragments out of the WHERE clause onto an axis. The tuple produced by the query parser is the same, but we get more metadata in the results to see the context of the query. For example, try this:</p>
<pre>SELECT 
([Date].[Date].[January 1, 2008], [Measures].[Sales Amount]) ON COLUMNS,
[Product].[Product].&amp;[359] ON ROWS
FROM [Adventure Works]</pre>
<p>Here you see the results of the new query.</p>
<p><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-03.gif"><img class="aligncenter size-full wp-image-605" title="mdx-03" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-03.gif" alt="" width="229" height="87" /></a></p>
<p>You can put any member of the tuple on either rows or columns. You can even write the query to show rows first and columns second like this:</p>
<pre>SELECT 
[Product].[Product].&amp;[359] ON COLUMNS,
([Date].[Date].[January 1, 2008], [Measures].[Sales Amount]) on ROWS
FROM [Adventure Works]</pre>
<p>But the result of your query stays the same. You can have a query that only has a tuple fragment on columns like this:</p>
<pre>SELECT 
([Date].[Date].[January 1, 2008], [Measures].[Sales Amount]) ON COLUMNS
FROM [Adventure Works]</pre>
<p>But you cannot have a query that has a tuple fragment on rows like this:</p>
<pre>SELECT 
([Date].[Date].[January 1, 2008], [Measures].[Sales Amount]) ON ROWS
FROM [Adventure Works]</pre>
<p>If I don&#8217;t ask for something in a tuple explicitly by putting it on columns, on rows, or in the WHERE clause, Analysis Services plugs in the All member for the dimension and hierarchy that I didn&#8217;t include. Usually. There is an exception but we&#8217;ll save that explanation for another post. This behavior is especially helpful when you have lots of dimensions and hierarchies. Otherwise, you&#8217;d have a tuple that is  ginormous (your new technical term for the day).</p>
<h3>Using Sets in a Query</h3>
<p>Asking for data one tuple at a time is rather tedious. Fortunately, we can take our knowledge about query construction to the next level. Technically speaking, when we put a member on columns or rows, we were asking for a set. A set of one. When we put the tuple fragment on columns or rows, we were creating a tuple set. Another option is to explicitly create a set like this:</p>
<pre>SELECT
{[Date].[Date].[January 1, 2008], [Date].[Date].[February 1, 2008]} ON COLUMNS,
[Product].[Product].&amp;[359] ON ROWS
FROM [Adventure Works]
WHERE [Measures].[Sales Amount]</pre>
<p><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-04.gif"><img class="aligncenter size-full wp-image-607" title="mdx-04" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/mdx-04.gif" alt="" width="305" height="43" /></a></p>
<p>Whereas we use parentheses to denote a tuple, we use braces to denote a set. The order in which we define the member of the set determines the order in which the members display in the results. Try changing the sequence of members in the set to see the results.</p>
<p>MDX provides us with lots of functions to produce sets or to produce members that we use in sets so that we don&#8217;t have to list out members explicitly in a query. In my next post, we&#8217;ll explore some some of these functions.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.datainspirations.com/2011/12/14/sqlu-mdx-week-writing-simple-queries/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQLU MDX Week: Location, Location, Location</title>
		<link>http://blog.datainspirations.com/2011/12/13/sqlu-mdx-week-location-location-location/</link>
		<comments>http://blog.datainspirations.com/2011/12/13/sqlu-mdx-week-location-location-location/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 19:20:01 +0000</pubDate>
		<dc:creator>Stacia Misner</dc:creator>
				<category><![CDATA[Analysis Services]]></category>

		<guid isPermaLink="false">http://blog.datainspirations.com/?p=588</guid>
		<description><![CDATA[Once again, I am serving as the professor at SQL University during MDX week. MDX stands for MultiDimension eXpression language and we use it to add business logic to cubes in the form of calculations, named sets, and KPIs as well as to configure security and to write reports. I can’t teach you everything you need [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlchicken.com/sql-university" target="_blank"><img class="size-full wp-image-428 alignleft" title="SQL University" src="http://blog.datainspirations.com/wp-content/uploads/2011/05/SQL_University.png" alt="" width="175" height="200" /></a><br />
Once again, I am serving as the professor at <a href="http://sqlchicken.com/sql-university/" target="_blank">SQL University</a> during MDX week. MDX stands for MultiDimension eXpression language and we use it to add business logic to cubes in the form of calculations, named sets, and KPIs as well as to configure security and to write reports. I can’t teach you everything you need to know about MDX in just a few blog posts this week, but I can help you get into the right frame of mind to learn MDX, to get some insight into how the language works, and where to learn more to further your studies.</p>
<p>Before you undertake MDX, you should know something about Analysis Services and cubes. Earlier this year, I presented a series of posts as part of SQL  University to introduce you to this topic:</p>
<ul>
<li><a href="http://blog.datainspirations.com/2011/05/11/sqlu-ssas-week-why-do-i-need-a-cube-how-do-i-get-started/" target="_blank">Why Do I Need a Cube and How Do I Get Started?</a></li>
<li><a href="http://blog.datainspirations.com/2011/05/11/sqlu-ssas-week-dimension-design-101-2/" target="_blank">Dimension Design 101</a></li>
<li><a href="http://blog.datainspirations.com/2011/05/12/sqlu-ssas-week-cube-construction-101/" target="_blank">Cube Construction 101</a></li>
<li><a href="http://blog.datainspirations.com/2011/05/15/sqlu-ssas-week-cube-enhancements-101/" target="_blank">Cube Enhancements 101</a></li>
<li><a href="http://blog.datainspirations.com/2011/05/17/sqlu-ssas-week-cube-deployment-101/" target="_blank">Cube Deployment 101</a></li>
</ul>
<p>Before we dive into using MDX later this week, let’s start with perhaps the most fundamental concept that you need to understand – location, location, location.</p>
<h3><strong>Build On What You Know</strong></h3>
<p>You’ve probably used an Excel spreadsheet at some point and are familiar with using cell references to create formulas. For example, in the spreadsheet below, if I want to perform a calculation that includes the sales for the product “Mountain-200 Black, 38” on 1/1/2008, I would use the formula =B2. The letter B stands for the column reference and the number 2 stands for the row reference. It’s a two-dimensional cell reference.</p>
<p style="text-align: center;"><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/excel-01.png"><img class="aligncenter size-large wp-image-589" title="excel-01" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/excel-01-1024x251.png" alt="" width="540" height="133" /></a></p>
<p>“OK,” you’re thinking. “I got that. Rudimentary Excel. What does that have to do with MDX?” Bear with me a little bit longer and I’ll connect the dots for you.</p>
<p>Now consider that I have two sheets in a workbook with a similar layout. One sheet for 2008 sales and one sheet for 2007 sales. I want to calculate total sales for the same product in January. In this case, I can use the formula =’Sales 2008’!B2 + ‘Sales 2007’!B2. I’ve added a third dimension, the sheet name, to the cell references to tell Excel where to find the data for the calculation.</p>
<p style="text-align: center;"><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/excel-02.png"><img class="aligncenter size-large wp-image-590" title="excel-02" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/excel-02-1024x407.png" alt="" width="675" height="268" /></a></p>
<p>Let’s continue expanding on this concept:</p>
<ul>
<li>For four dimensions, let’s assume that I have a separate workbook for different stores and I want to combine the sales for all stores for the same product and same month across the two years. My formula would now look like this – ‘[Store A.xlsx]Sales 2008’!B2 + ‘[Store B.xlsx]Sales 2008’!B2 + ‘[Store A.xlsx]Sales 2007’!B2 + ‘[Store B.xlsx]Sales 2007’!B2.</li>
<li>For five dimensions, I might use different folders on the same drive to store workbooks by promotion. So now each workbook reference would look something like this: ‘[C:\Top Customer Promotion\Store A.xlsx]Sales 2008’!B2.</li>
<li>Moving on to six dimensions, I can reference workbooks on different drives.</li>
<li>For seven dimensions, I can reference workbooks on different servers.</li>
</ul>
<p>Now I’m going to get a bit silly, but just use your imagination with me for a moment because I can’t really do this. It’s just expanding the concept of location. Here goes… I can reference workbooks on different servers on different floors (eight dimensions), in different buildings (nine dimensions), on different streets (ten dimensions), in different cities (eleven dimensions), in different states (twelve dimensions), in different countries (thirteen dimensions), on different planets (fourteen dimensions) in different universes (fifteen dimensions)!</p>
<p>Okay, I’ve probably gone a bit too far with this example, and technically speaking, I wouldn’t make each of these aspects of a location into a separate dimension from an Analysis Services point of view. But I want you to get the idea that I can use location references in my Excel formulas to be very precise about which data to include in the formula. Excel understands relative references and absolute references. If you don’t tell it otherwise, it’s going to assume that you want a relative reference. That is, use the current cell, column, sheet,  or whatever that happens to be “current” for the cell in which you are typing the formula unless you give it explicit instructions to use a different cell, columns, sheet, or whatever.</p>
<h3>And Now for the Tuple</h3>
<p>Now let’s bring this back to MDX. A key concept in MDX is the tuple. I say tuh-ple because I learned it that way and I’m too old to change. (Think quintuple, sextuple, octuple – et cetera. The letter u is short the way that I learned.) Some people say too-ple, and that’s okay too. The beauty of reading a blog post is that you can read it with whichever pronunciation you prefer and my pronunciation won’t get in your way!</p>
<p>Let’s move our sales data from Excel into an Analysis Services cube. I’ve simplified the product name because the tire size in there seems to distract people. So “Mountain-200 Black, 38” becomes “Mountain-200 Black.”</p>
<p style="text-align: center;"><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/tuple-01.png"><img class="aligncenter size-full wp-image-591" title="tuple-01" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/tuple-01.png" alt="" width="499" height="326" /></a></p>
<p>To get data from a cube, I need to ask for that data in the form of a tuple. A tuple consists of one member from every dimension. So in my two dimensional representation of cube data above, the tuple to get sales for the Mountain-200 Black product in January would be (Mountain-200 Black, 1/1/2008).</p>
<p>Actually, that’s what I call a pseudo-tuple because it’s not exactly the way we would write it in MDX, but I don’t want you to get distracted by the details. For now, let’s focus on the concepts of a tuple.</p>
<p>Tuples are like coordinates that you learned in geometry. If you have a graph with two dimensions, x and y, you represent a point by using the coordinate (x,y). In geometry, order matters – the x must come before the y. But with tuples, order does NOT matter. We can write your example above as either (Mountain-200 Black, 1/1/2008) or (1/1/2008, Mountain-200 Black) and get the same answer: $66,095.71.</p>
<p>Now in our cube, most dimensions have an All level. And that counts as a cell, too. So we can create a tuple (All Products, All Dates) to get the grand total sales: $4,831,250.71.</p>
<p style="text-align: center;"><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/tuple-02.png"><img class="aligncenter size-full wp-image-592" title="tuple-02" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/tuple-02.png" alt="" width="527" height="337" /></a></p>
<p>If we have two kinds of measures in our sales, Sales Amount and Order Quantity, then that adds a third dimension to our cube. So our tuple changes accordingly to include the new dimension: (Mountain-200 Black, 1/1/2008, Sales Amount).</p>
<p style="text-align: center;"><a href="http://blog.datainspirations.com/wp-content/uploads/2011/12/tuple-03.png"><img class="aligncenter size-large wp-image-593" title="tuple-03" src="http://blog.datainspirations.com/wp-content/uploads/2011/12/tuple-03-1024x569.png" alt="" width="614" height="341" /></a></p>
<p>In summary, a tuple is just a location in a cube. We use it to tell Analysis Services where to find the data that we want. Using MDX functions, we can describe sets of tuples that we want to access “as is” or use in formulas. In my next post, I’ll explain how to write simple MDX queries using this concept of tuples.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.datainspirations.com/2011/12/13/sqlu-mdx-week-location-location-location/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Button, Button, Who&#8217;s Got the Button?</title>
		<link>http://blog.datainspirations.com/2011/12/08/button-button-whos-got-the-button/</link>
		<comments>http://blog.datainspirations.com/2011/12/08/button-button-whos-got-the-button/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 13:09:03 +0000</pubDate>
		<dc:creator>Stacia Misner</dc:creator>
				<category><![CDATA[Reporting Services]]></category>

		<guid isPermaLink="false">http://blog.datainspirations.com/?p=575</guid>
		<description><![CDATA[Yes, I&#8217;ve been quiet lately. I have a ton of ideas lining up for blog posts, but I need to get back to a &#8220;normal&#8221; pace. After conference season (PASS and Connections), I have been super busy with various projects &#8211; like co-authoring Introducing SQL Server 2012 with Ross Mistry and teaching classes like BI [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, I&#8217;ve been quiet lately. I have a ton of ideas lining up for blog posts, but I need to get back to a &#8220;normal&#8221; pace. After conference season (PASS and Connections), I have been super busy with various projects &#8211; like co-authoring <a href="http://blogs.msdn.com/b/microsoft_press/archive/2011/10/11/free-ebook-introducing-microsoft-sql-server-code-name-denali-draft-preview.aspx" target="_blank">Introducing SQL Server 2012</a> with Ross Mistry and teaching classes like <a href="http://www.sqlskills.com/T_ImmersionBI.asp" target="_blank">BI Immersion</a> this week. One might say I&#8217;m having too much fun! Is that possible?</p>
<h3>Background</h3>
<p>Today&#8217;s post was inspired by a problem I encountered on the first day of the BI Immersion class. To make things easier for folks to have a working environment in which to try out the topics we discuss during the BI Immersion class, I recommend they get a <a href="http://tinyurl.com/858o27a" target="_blank">freely available VHD</a> with the entire Microsoft BI stack installed and configured. It&#8217;s evaluation software so it only works for a limited time, but it should be enough time for learning until you get your own permanent environment set up. Also, it&#8217;s not quite the entire BI stack, but we fix that during class by adding PowerPivot for SharePoint and adding another Reporting Services instance in SharePoint integrated mode. (Side note: Adding PowerPivot for SharePoint to an existing farm can be challenging &#8211; may need to <a href="http://www.cjvandyk.com/blog/Articles/How%20do%20I%20-%20Install%20PowerPivot%20into%20an%20EXISTING%20SharePoint%202010%20farm.aspx" target="_blank">do some fiddling</a> to get it working.)</p>
<h3>The Problem</h3>
<p>As I was demonstrating Reporting Services (native mode) using the aforementioned VHD, I noticed that the Data Feed button was missing from the HTML Viewer toolbar. Yet, it was there in the toolbar when using Reporting Services in SharePoint integrated mode. You use this button to export data to PowerPivot for Excel &#8211; or any application that can consume an ATOM data feed. Where did the button go?</p>
<h3>The Solution</h3>
<p>My guess is that this VHD was not created from scratch using SQL Server 2008 R2, but rather migrated from an earlier version and somehow the RSReportServer.config file didn&#8217;t update properly. When I looked at the file for clues about the data feed button, I noticed that a rendering extension was missing. I added it back in as shown below (see the highlighted text), then opened up Report Manager to look at a report. Hooray &#8211; the button is back!</p>
<p>(Sorry about the lack of wrapping &#8211; I&#8217;ll fix it later. Have to get to class!)</p>
<pre>&lt;Render&gt;
&lt;Extension Name="XML" Type="Microsoft.ReportingServices.Rendering.DataRenderer.XmlDataReport,Microsoft.ReportingServices.DataRendering"/&gt;
&lt;Extension Name="NULL" Type="Microsoft.ReportingServices.Rendering.NullRenderer.NullReport,Microsoft.ReportingServices.NullRendering" Visible="False"/&gt;
&lt;Extension Name="CSV" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering"/&gt;
&lt;Extension Name="PDF" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.PDFRenderer,Microsoft.ReportingServices.ImageRendering"/&gt;
&lt;Extension Name="RGDI" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.RGDIRenderer,Microsoft.ReportingServices.ImageRendering" Visible="False"/&gt;
&lt;Extension Name="HTML4.0" Type="Microsoft.ReportingServices.Rendering.HtmlRenderer.Html40RenderingExtension,Microsoft.ReportingServices.HtmlRendering" Visible="False"/&gt;
&lt;Extension Name="MHTML" Type="Microsoft.ReportingServices.Rendering.HtmlRenderer.MHtmlRenderingExtension,Microsoft.ReportingServices.HtmlRendering"/&gt;
&lt;Extension Name="EXCEL" Type="Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering"/&gt;
&lt;Extension Name="RPL" Type="Microsoft.ReportingServices.Rendering.RPLRendering.RPLRenderer,Microsoft.ReportingServices.RPLRendering" Visible="False" LogAllExecutionRequests="False"/&gt;
&lt;Extension Name="IMAGE" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRenderer,Microsoft.ReportingServices.ImageRendering"/&gt;
&lt;Extension Name="WORD" Type="Microsoft.ReportingServices.Rendering.WordRenderer.WordDocumentRenderer,Microsoft.ReportingServices.WordRendering"/&gt;
<strong>&lt;Extension Name="ATOM" Type="Microsoft.ReportingServices.Rendering.DataRenderer.AtomDataReport,Microsoft.ReportingServices.DataRendering" Visible="false"/&gt;</strong>
&lt;/Render&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.datainspirations.com/2011/12/08/button-button-whos-got-the-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Book Review: MDX with Microsoft SQL Server 2008 R2 Analysis Services Cookbook</title>
		<link>http://blog.datainspirations.com/2011/10/21/book-review-mdx-with-microsoft-sql-server-2008-r2-analysis-services-cookbook/</link>
		<comments>http://blog.datainspirations.com/2011/10/21/book-review-mdx-with-microsoft-sql-server-2008-r2-analysis-services-cookbook/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 19:39:49 +0000</pubDate>
		<dc:creator>Stacia Misner</dc:creator>
				<category><![CDATA[Analysis Services]]></category>
		<category><![CDATA[Book Review]]></category>
		<category><![CDATA[MDX]]></category>

		<guid isPermaLink="false">http://blog.datainspirations.com/2011/10/21/book-review-mdx-with-microsoft-sql-server-2008-r2-analysis-services-cookbook/</guid>
		<description><![CDATA[As I mentioned in an earlier post, I first met Tomislav Piasevoli’s (blog&#124;twitter) in 2008 at the PASS Summit in Seattle, and saw him again most recently again in Seattle at PASS Summit 2011. There I had the pleasure of telling him personally how much I liked his book. There are not many MDX books [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.packtpub.com/mdx-with-microsoft-sql-server-2008-r2-analysis-services/book"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: left; padding-top: 0px; border: 0px;" title="1308EN_MDX with Microsoft SQL Server Analysis Services 2008 R2 Cookbook" src="http://blog.datainspirations.com/wp-content/uploads/2010/11/Book-Review-MDX-with-Microsoft-SQL-Serve_857B/1308EN_MDX-with-Microsoft-SQL-Server-Analysis-Services-2008-R2-Cookbook_thumb.png" border="0" alt="1308EN_MDX with Microsoft SQL Server Analysis Services 2008 R2 Cookbook" width="125" height="152" align="left" /></a></p>
<p>As I mentioned in <a href="http://blog.datainspirations.com/2011/09/09/back-to-the-future-with-mdx-and-pass/" target="_blank">an earlier post</a>, I first met Tomislav Piasevoli’s (<a href="http://tomislav.piasevoli.com/" target="_blank">blog</a>|<a href="http://twitter.com/tpiasevoli" target="_blank">twitter</a>) in 2008 at the PASS Summit in Seattle, and saw him again most recently again in Seattle at <a href="http://www.sqlpass.org/summit/2011/" target="_blank">PASS Summit 2011</a>. There I had the pleasure of telling him personally how much I liked his book. There are not many MDX books available, so when a new one arrives on the market, I definitely want to take a look. Now I have taught MDX classes for many years, and I think perhaps my first class was in 2002. However, it’s been so long now, I don’t recall exactly when that first class was. What I do know is that my understanding of MDX and my fluency with the language has grown by leaps and bounds since then through experience with all kinds of bleeding edge MDX, and I have tried to communicate some of my insights developed along the way to students in my classroom. MDX concepts can stretch your thinking (to put it mildly), and more so if you have to unlearn SQL concepts as well, which is true of the majority of my students. As a native English speaker, I can find it challenging at times to explain certain aspects of MDX. For all these reasons, I can fully appreciate Tomislav’s efforts to create this book and commend him for his excellent examples and explanations using a language that is not his mother tongue.</p>
<p>Tomislav’s book is definitely not for beginners. There is an underlying assumption that you already have some familiarity with the basics of MDX. The purpose of this book is to provide you with the tools necessary to continue building your skills. The chapters group together a series of related concepts, called recipes. You don’t need to read the book sequentially from cover to cover. Instead, you search for the desired outcome, such as handling division by zero errors (described in Chapter 1) or calculating row numbers (found in Chapter 7). Ideally, you don’t just read the recipe, but actually try out the steps yourself. I did some of my reading of this book when I was away from my laptop, and frequently found that I wanted to try out something that Tomislav mentioned. Even long-time MDX developers like myself can find interesting tidbits of information to round out their repertoire!</p>
<p>Each concept within a chapter is presented in a similar manner, beginning with “Getting ready” which are the steps you need to perform to set up your query. For example, you might need to work in Management Studio and set up a query as a starting point or open the Script View for a cube in Business Intelligence Development Studio. Then the next section is “How to do it…” which provides step-by-step instructions for working with a query or MDX script to accomplish the intended outcome. Then Tomislav continues with the “How it works…” section which provides background information on the key concepts for the current recipe. This section is the real meat of the book, but is nicely separated from the implementation steps if you want to jump straight to the technical details. Depending on the recipe, Tomislav also includes additional sections, such as “There’s more…” to provide alternative solutions or to point you to helpful links on the Internet such as whitepapers and blog articles providing more insight, and “See also…” to cross-reference you to another recipe in the book that covers a closely related concept.  Where applicable, he also includes information about how the techniques in the recipe behave differently in earlier versions of Analysis Services.</p>
<h5>Chapter 1: Elementary MDX Techniques</h5>
<p>Don’t let the word Elementary fool you into thinking you can learn entry-level MDX from this chapter. As I mentioned earlier, this book is not for beginners. There are good techniques here and a few basics, such as a great explanation of the FORMAT_STRING property and troubleshooting its use. However, I would consider the majority of these techniques to be elementary only as compared to the other techniques found later in the book. For example, the WHERE clause is one of those things that I see people really get into a tangle over (because they can’t forget their T-SQL), and Tomislav demonstrates using it to implement a logical OR on members from different hierarchies and a logical AND for members from the same hierarchy. One of my favorite sections in this chapter is the coverage of alternatives for the FILTER() function, which can cause performance problems. Use this chapter to get grounded with some foundational concepts, then strap on your seatbelt before diving into the rest of the book!</p>
<h5>Chapter 2: Working with Time</h5>
<p>Time is something that every cube has. Or at least every cube that I’ve ever met. I can’t imagine a cube without one (even if it’s called Date) because often business analysis is comparing one period to another or monitoring trends over time. Tomislav starts with the basics of the YTD() function but delves into variations on the theme and points out pitfalls to avoid. He moves on to parallel periods, moving averages, and finding last dates with data, among other time-related topics. A useful recipe in this chapter is the use of string functions to calculate a date, as I see this requirement a lot when working with Reporting Services reports that use Analysis Services as a source. A good case for working with a single-member named set rather than a calculated member is also made in this chapter.</p>
<h5>Chapter 3: Concise Reporting</h5>
<p>A report in this chapter means a pivot table used in some front-end tool for Analysis Services, and not Reporting Services exclusively. The goal of this chapter is to reduce the size of the pivot table, and thereby improve performance. I would characterize this chapter as one that helps you find the best or the worst members in a group, whether in a hierarchy, among siblings, or among descendants. Tomislav starts off the chapter with a recipe to get the top N members. In this recipe, Tomislav includes a great explanation of what can go wrong when you use the TopCount() function. Well, it’s not a matter of it behaving incorrectly because it’s doing what you ask. The problem is that many people misunderstand how the TopCount() function behaves under certain conditions and Tomislav delves deeply into the behavior here. He then builds on these ideas throughout the chapter and introduces alternatives for finding and displaying the best and the worst.</p>
<h5>Chapter 4: Navigation</h5>
<p>Hierarchies in a dimension are extremely useful for a number of reasons, one of which is navigation. The chapter begins with some simple queries that use Boolean logic to test the context of a current member on the row axis, and then expands to use scoping in the MDX script or use a query (using CELL CALCULATION) to determine if members are in the same branch of a hierarchy. Are you confused about when to use the Exists() function and the EXISTING keyword? Tomislav covers them both in this chapter in a variety of contexts. Also, having advocated on behalf of a named set in a previous chapter, Tomislav explores the pros and cons of named sets more fully in this chapter.</p>
<h5>Chapter 5: Business Analytics</h5>
<p>This chapter covers several techniques that are encountered less frequently (depending on who you ask, I suppose) than those covered up to this point in the book. For example, the chapter begins with linear regression which I’ve never had to use in 10 years of writing MDX. But I said the same about the Correlation() function once upon a time and I now use it frequently in a current project, so my feeling is that you never know when you’ll need to use a seemingly obscure function. Because these analytical functions are used less commonly, the amount of information available through Books Online or elsewhere on the Internet is pretty slim. Therefore, having this chapter’s working examples at your fingertips is invaluable. Also covered in this chapter is adjusting forecasts based on periodic cycles, alternative approaches to expense allocations, finding slow-moving inventory items, categorizing customers, and ABC analysis (which is an application of Pareto analysis).</p>
<h5>Chapter 6: When MDX is Not Enough</h5>
<p>In this chapter, Tomislav makes the case that when an MDX approach gets overly complicated, it’s time to look at making changes to the dimension or cube design. For example, he says, “Every time you catch yourself using functions like Except(), Filter(), or similar() too often in your calculations, you should step back and consider whether that’s a repeating behavior and whether it would pay off to have an attribute to separate the data you’ve been separating using MDX calculations.” He also explains how and why to create a placeholder measure in the cube to use with assignments in the MDX script. Utility dimensions for unit conversion or for time-based calculations are also covered in this chapter.</p>
<h5>Chapter 7: Context-aware Calculations</h5>
<p>Understanding context is an important aspect of MDX development. As Tomislav explains in the introduction to this chapter, context can be unpredictable based on what a user might select to place on rows and columns, or it can be partially known when you expect a particular measure or hierarchy to be used, or it can be completely known. The trick is to produce a calculation that behaves correctly regardless of context, which can be made trickier based on a combination of factors that Tomislav describes. The recipes in this chapter help you explore context from a number of, um, contexts, starting with how to know how many columns and rows will be in a query’s result set, how to determine which axis contains measures, how to determine what has been placed on an axis, among other useful techniques.</p>
<h5>Chapter 8: Advanced MDX Topics</h5>
<p>Now frankly I considered several of the recipes up to this point to be advanced, so I had to chuckle at the title of this chapter. Let’s just say these recipes are more complex! In this chapter, you’ll find techniques for working with parent-child hierarchies and displaying random values for sampling purposes. Hopefully, you’re avoiding the use of parent-child hierarchies and random sampling is not a common request in reports, so this section of the chapter is interesting primarily from an academic viewpoint. But then we move to complex sorts – a very useful subject indeed. Tomislav provides several examples and highlights potential problem areas. Also in this chapter is a recipe for recursively calculating cumulative values.</p>
<h5>Chapter 9: On the Edge</h5>
<p>Tomislav uses this chapter to collect topics that don’t neatly fit into the earlier chapters. Here he covers Analysis Services stored procedures (which are nothing like T-SQL stored procedures, by the way), as well as using the OPENQUERY() and OPENROWSET() functions for calling MDX from a T-SQL statement. He also introduces Dynamic Management Views (DMVs) for documenting and monitoring cubes, and shows how to use SQL Server Profiler to capture MDX queries. Last, he shows how to use the DRILLTHROUGH command.</p>
<p>If you’re an MDX developer, whether brand new or experienced, you will find lots of good information in this book and practical examples of how and why to implement specific techniques. I definitely recommend that you add it to your library, in whatever format you prefer. It’s available in <a href="http://www.packtpub.com/mdx-with-microsoft-sql-server-2008-r2-analysis-services/book" target="_blank">paperback, PDF, ePub and Mobi from the publisher</a> and in <a href="http://www.amazon.com/Microsoft-Analysis-Services-Cookbook-ebook/dp/B005HIK89S/ref=sr_1_2?ie=UTF8&amp;qid=1319215803&amp;sr=8-2" target="_blank">Kindle format from Amazon</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.datainspirations.com/2011/10/21/book-review-mdx-with-microsoft-sql-server-2008-r2-analysis-services-cookbook/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

