<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><!-- generator="Joomla! 1.5 - Open Source Content Management" --><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
	<channel>
		<title>Microsoft SQL Server Analysis Services 2005/2008 articles - MDX, performance, management</title>
		<description />
		<link>http://www.ssas-info.com/analysis-services-articles</link>
		<lastBuildDate>Thu, 24 May 2012 12:06:49 +0000</lastBuildDate>
		<generator>Joomla! 1.5 - Open Source Content Management</generator>
		<language>en-gb</language>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/SSAS_Articles" /><feedburner:info uri="ssas_articles" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
			<title>Row security and hierarchies-part 1</title>
			<link>http://feedproxy.google.com/~r/SSAS_Articles/~3/scidYZ9Eip4/3478-row-security-and-hierarchies-part-1</link>
			<guid isPermaLink="false">http://www.ssas-info.com/analysis-services-articles/97-tabular/3478-row-security-and-hierarchies-part-1</guid>
			<description>&lt;p&gt;Fair warning: this is going to be complicated. In this post, I am going to assume that you've read the row security whitepaper, you are familiar with how parent/child hierarchies work in the tabular model, and you can deal with fairly complicated DAX concepts. For a primer on hierarchies, see Kasper's post. For DAX, I recommend a few months of experience after learning DAX. If you don't have that much DAX experience, let your eyes gently glaze over while I try to explain the DAX formulas, blindly copy/paste the formulas into your model, and hope for the best without trying to achieve true understanding (the latter is generally how I deal with DAX). Now to the post.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rSiSzsqsQKtMtpzV8hkGmfuG0H8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rSiSzsqsQKtMtpzV8hkGmfuG0H8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rSiSzsqsQKtMtpzV8hkGmfuG0H8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rSiSzsqsQKtMtpzV8hkGmfuG0H8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SSAS_Articles/~4/scidYZ9Eip4" height="1" width="1"/&gt;</description>
			<author>webadmin@ssas-info.com (Cathy Dumas)</author>
			<category>Tabular</category>
			<pubDate>Mon, 21 May 2012 21:28:04 +0000</pubDate>
		<feedburner:origLink>http://www.ssas-info.com/analysis-services-articles/97-tabular/3478-row-security-and-hierarchies-part-1</feedburner:origLink></item>
		<item>
			<title>Binding Excel to a custom MDX query supporting PivotTable filters</title>
			<link>http://feedproxy.google.com/~r/SSAS_Articles/~3/jDQkw5ci_Mc/3477-binding-excel-to-a-custom-mdx-query-supporting-piv</link>
			<guid isPermaLink="false">http://www.ssas-info.com/analysis-services-articles/50-mdx/3477-binding-excel-to-a-custom-mdx-query-supporting-piv</guid>
			<description>&lt;p&gt;Chris Webb wrote this post: Binding an Excel table to the results of an MDX query.  In a comment at the bottom, Scott Gall suggested using VBA.  I want to take this one step further to allow custom MDX to be filtered by the filters from the Pivot Table Field List, while not actually using a pivot table (similarly to formulas mode).&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/yq4GRlpTGkRW61WEYnXMz5RmsEo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/yq4GRlpTGkRW61WEYnXMz5RmsEo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/yq4GRlpTGkRW61WEYnXMz5RmsEo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/yq4GRlpTGkRW61WEYnXMz5RmsEo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SSAS_Articles/~4/jDQkw5ci_Mc" height="1" width="1"/&gt;</description>
			<author>webadmin@ssas-info.com (Christian Wade)</author>
			<category>MDX</category>
			<pubDate>Mon, 21 May 2012 21:28:03 +0000</pubDate>
		<feedburner:origLink>http://www.ssas-info.com/analysis-services-articles/50-mdx/3477-binding-excel-to-a-custom-mdx-query-supporting-piv</feedburner:origLink></item>
		<item>
			<title>Consolidation and Intercompany Elimination made easy using PowerPivot and DAX</title>
			<link>http://feedproxy.google.com/~r/SSAS_Articles/~3/OyFjOSNUvMw/3476-consolidation-and-intercompany-elimination-made-ea</link>
			<guid isPermaLink="false">http://www.ssas-info.com/analysis-services-articles/98-tabular-dax/3476-consolidation-and-intercompany-elimination-made-ea</guid>
			<description>&lt;p&gt;In my past years as a consultant for Microsoft BI I had to deal with financial models quite a lot. They are usually small in size but very complex in terms of calculations like currency conversion, margin-calculations, benchmarks and so on. Another topic I came across very frequently was consolidation and intercompany eliminations. Recently I had to deal with this topic again and thought of how this could be solved in PowerPivot/DAX.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/VYVYTfKTWqH8BQPEBrc-bVn9AvY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/VYVYTfKTWqH8BQPEBrc-bVn9AvY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/VYVYTfKTWqH8BQPEBrc-bVn9AvY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/VYVYTfKTWqH8BQPEBrc-bVn9AvY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SSAS_Articles/~4/OyFjOSNUvMw" height="1" width="1"/&gt;</description>
			<author>webadmin@ssas-info.com (Gerhard Brueckl)</author>
			<category>Tabular DAX</category>
			<pubDate>Mon, 21 May 2012 21:28:00 +0000</pubDate>
		<feedburner:origLink>http://www.ssas-info.com/analysis-services-articles/98-tabular-dax/3476-consolidation-and-intercompany-elimination-made-ea</feedburner:origLink></item>
		<item>
			<title>SCOPING at different granularities (Part III)</title>
			<link>http://feedproxy.google.com/~r/SSAS_Articles/~3/S3zgPu1-JQ0/3475-scoping-at-different-granularities--part-iii-</link>
			<guid isPermaLink="false">http://www.ssas-info.com/analysis-services-articles/98-tabular-dax/3475-scoping-at-different-granularities--part-iii-</guid>
			<description>&lt;p&gt;In the last two blog entries on this topic (available here and here), we got a bit closer to reproducing - in DAX - the same output one would normally achieve with the MDX scope statement. &lt;/p&gt;&lt;p&gt;  In this new entry, we perfect the formula a bit more by ensuring filter context propagates to the higher levels of granularity we are affecting.   &lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/BYOjEE44u-W3-VLxkMNcXy1Yzus/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BYOjEE44u-W3-VLxkMNcXy1Yzus/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/BYOjEE44u-W3-VLxkMNcXy1Yzus/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BYOjEE44u-W3-VLxkMNcXy1Yzus/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SSAS_Articles/~4/S3zgPu1-JQ0" height="1" width="1"/&gt;</description>
			<author>webadmin@ssas-info.com (Javier Guillen)</author>
			<category>Tabular DAX</category>
			<pubDate>Mon, 21 May 2012 21:27:59 +0000</pubDate>
		<feedburner:origLink>http://www.ssas-info.com/analysis-services-articles/98-tabular-dax/3475-scoping-at-different-granularities--part-iii-</feedburner:origLink></item>
		<item>
			<title>What happens when a SSAS Tabular model exceeds memory?</title>
			<link>http://feedproxy.google.com/~r/SSAS_Articles/~3/N1W8ika-3-8/3474-what-happens-when-a-ssas-tabular-model-exceeds-mem</link>
			<guid isPermaLink="false">http://www.ssas-info.com/analysis-services-articles/97-tabular/3474-what-happens-when-a-ssas-tabular-model-exceeds-mem</guid>
			<description>&lt;p&gt;If you are using the Tabular model in SSAS, it will use the xVelocity technology to load your entire database in memory (greatly compressing the database).  So what happens if your database is too big to fit in memory?  You will get this error when you process the model: &lt;blockquote&gt;"The following system error occurred: Insufficient quota to complete the requested service.&lt;/blockquote&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/BJpd0Sd2c8zZlAlY5OWlYp5cqlM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BJpd0Sd2c8zZlAlY5OWlYp5cqlM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/BJpd0Sd2c8zZlAlY5OWlYp5cqlM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BJpd0Sd2c8zZlAlY5OWlYp5cqlM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SSAS_Articles/~4/N1W8ika-3-8" height="1" width="1"/&gt;</description>
			<author>webadmin@ssas-info.com (James Serra)</author>
			<category>Tabular</category>
			<pubDate>Mon, 21 May 2012 21:27:57 +0000</pubDate>
		<feedburner:origLink>http://www.ssas-info.com/analysis-services-articles/97-tabular/3474-what-happens-when-a-ssas-tabular-model-exceeds-mem</feedburner:origLink></item>
		<item>
			<title>Excel 5-Calendar Date Table</title>
			<link>http://feedproxy.google.com/~r/SSAS_Articles/~3/J9YPu7QkqX4/3473-excel-5-calendar-date-table</link>
			<guid isPermaLink="false">http://www.ssas-info.com/analysis-services-articles/66-mgmt/3473-excel-5-calendar-date-table</guid>
			<description>&lt;p&gt;For some time, I have been looking around for a fairly complete date table in Excel for use with PowerPivot. If you are working with data derived from a data warehouse, a date table is perhaps the most common dimension table that exists in the warehouse. However, not every scenario involves working with a data warehouse directly, and I simply wanted a "portable" date table. I found very little online, the best perhaps being this Excel table offered by the Kimball group (the table has been expanded since I originally downloaded it). I could have modified the Kimball table for my particular needs, but I decided to create one from scratch.  Late last year, Rob posted an article titled the Ultimate Date Table, which is available from the Azure Marketplace. I considered using this table instead of the one I was building in Excel, but the "Ultimate Table" lacks fiscal periods. Much of the analysis work I do includes fiscal periods.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/c21juClSpsijQqERiw1zx0OEiNE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/c21juClSpsijQqERiw1zx0OEiNE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/c21juClSpsijQqERiw1zx0OEiNE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/c21juClSpsijQqERiw1zx0OEiNE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SSAS_Articles/~4/J9YPu7QkqX4" height="1" width="1"/&gt;</description>
			<author>webadmin@ssas-info.com (Colin Banfield)</author>
			<category>Management</category>
			<pubDate>Mon, 21 May 2012 21:27:55 +0000</pubDate>
		<feedburner:origLink>http://www.ssas-info.com/analysis-services-articles/66-mgmt/3473-excel-5-calendar-date-table</feedburner:origLink></item>
		<item>
			<title>Publishing Tabular Models to SSAS</title>
			<link>http://feedproxy.google.com/~r/SSAS_Articles/~3/0CHpNt4U16Q/3472-publishing-tabular-models-to-ssas</link>
			<guid isPermaLink="false">http://www.ssas-info.com/analysis-services-articles/98-tabular-dax/3472-publishing-tabular-models-to-ssas</guid>
			<description>&lt;p&gt;This is a follow-up from my blog post last month here on SQL Server Pro about utilizing common traditional reporting tools like Excel and Report Builder with the new SQL Server 2012 Tabular models (http://www.sqlmag.com/blog/sql-server-bi-blog-17/business-intelligence/report-builder-tabular-model-databases-142942) . I've received a few notes about some confusion concerning the processes to publish PowerPivot-generated models and the Visual Studio SSDT-generated models to SSAS 2012. I was sent a question pointing to the currently empty Books on Line entry on the "Restore from PowerPivot" technique that I was advocating: http://msdn.microsoft.com/en-us/library/hh230822.aspx.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PnwC8Ej_1DNdnHfAKpS-WidTCT0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PnwC8Ej_1DNdnHfAKpS-WidTCT0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PnwC8Ej_1DNdnHfAKpS-WidTCT0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PnwC8Ej_1DNdnHfAKpS-WidTCT0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SSAS_Articles/~4/0CHpNt4U16Q" height="1" width="1"/&gt;</description>
			<author>webadmin@ssas-info.com (Mark Kromer)</author>
			<category>Tabular DAX</category>
			<pubDate>Mon, 21 May 2012 21:27:53 +0000</pubDate>
		<feedburner:origLink>http://www.ssas-info.com/analysis-services-articles/98-tabular-dax/3472-publishing-tabular-models-to-ssas</feedburner:origLink></item>
		<item>
			<title>Named Sets and Block Computation in SSAS 2012</title>
			<link>http://feedproxy.google.com/~r/SSAS_Articles/~3/aGm8W2oxc5w/3469-named-sets-and-block-computation-in-ssas-2012</link>
			<guid isPermaLink="false">http://www.ssas-info.com/analysis-services-articles/50-mdx/3469-named-sets-and-block-computation-in-ssas-2012</guid>
			<description>&lt;p&gt;&lt;strong&gt;Reposted from &lt;a href="http://cwebbbi.wordpress.com/2012/05/16/named-sets-and-block-computation-in-ssas-2012/" target="_blank"&gt;Chris Webb's blog&lt;/a&gt; with the author's permission. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.artisconsulting.com/blogs/greggalloway/default.aspx"&gt;Greg Galloway&lt;/a&gt; (who really should blog more often!) recently came across an otherwise undocumented query performance optimisation in SSAS 2012: using named sets inside aggregate functions in MDX no longer prevents the use of block computation/bulk mode. This was something that was explicitly called out as a Bad Thing To Do in Books Online (the link to the page in question is now dead though, possibly because it’s being updated), but here’s an example of a query that will now run much faster in SSAS 2012 Multidimensional than it used to in R2:&lt;/p&gt;
&lt;p&gt;with &lt;br /&gt;set myset as {[Customer].[Customer].[Customer].members} &lt;br /&gt;member measures.demo as &lt;br /&gt;sum(myset,[Measures].[Internet Sales Amount]) &lt;br /&gt;select measures.demo on 0, &lt;br /&gt;[Date].[Calendar Year].members on 1 &lt;br /&gt;from [Adventure Works]&lt;/p&gt;
&lt;p&gt;There are still situations where block computation can’t be used however, namely when the &lt;a href="http://msdn.microsoft.com/en-us/library/ms145505.aspx"&gt;Current()&lt;/a&gt; function is used (which are going to be very rare I think):&lt;/p&gt;
&lt;p&gt;with &lt;br /&gt;set myset as {[Customer].[Customer].[Customer].members} &lt;br /&gt;member measures.demo as &lt;br /&gt;sum(myset &lt;br /&gt;, iif(myset.current is [Customer].[Customer].&amp;amp;[20075] &lt;br /&gt;, 0, [Measures].[Internet Sales Amount]) &lt;br /&gt;) &lt;br /&gt;select measures.demo on 0, &lt;br /&gt;[Date].[Calendar Year].members on 1 &lt;br /&gt;from [Adventure Works]&lt;/p&gt;
&lt;p&gt;Thanks also to &lt;a href="http://mdxdax.blogspot.co.uk/"&gt;Jeffrey Wang&lt;/a&gt; for the background on this.&lt;/p&gt;
&lt;hr /&gt;
&lt;table border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="http://www.ssas-info.com/images/stories/authors/chris-webb.png" border="0" alt="chris-webb" width="60" height="82" /&gt;&lt;/td&gt;
&lt;td&gt; &lt;/td&gt;
&lt;td&gt;
&lt;p&gt;Chris has been working with Microsoft BI tools since he started using beta 3 of OLAP Services back in the late 90s. Since then he has worked with Analysis Services in a number of roles (including three years spent with Microsoft Consulting Services) and he is now an independent consultant specialising in complex MDX, Analysis Services cube design and Analysis Services query performance problems. His company website can be found at &lt;a href="http://www.crossjoin.co.uk" target="_blank"&gt;http://www.crossjoin.co.uk&lt;/a&gt; and his blog can be found at &lt;a href="http://cwebbbi.wordpress.com"&gt;http://cwebbbi.wordpress.com&lt;/a&gt; .&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/VvMezU1IW5AzmvQRhjt_aTihhRk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/VvMezU1IW5AzmvQRhjt_aTihhRk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/VvMezU1IW5AzmvQRhjt_aTihhRk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/VvMezU1IW5AzmvQRhjt_aTihhRk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SSAS_Articles/~4/aGm8W2oxc5w" height="1" width="1"/&gt;</description>
			<author>author-chris-webb@ssas-info.com (Chris Webb)</author>
			<category>MDX</category>
			<pubDate>Thu, 17 May 2012 02:52:40 +0000</pubDate>
		<feedburner:origLink>http://www.ssas-info.com/analysis-services-articles/50-mdx/3469-named-sets-and-block-computation-in-ssas-2012</feedburner:origLink></item>
		<item>
			<title>Filters aren't applied to related tables in PowerPivot unless a measure is added to the PowerPivot Workbook</title>
			<link>http://feedproxy.google.com/~r/SSAS_Articles/~3/jaEF1KT3KWo/3470-filters-aren--t-applied-to-related-tables-in-power</link>
			<guid isPermaLink="false">http://www.ssas-info.com/analysis-services-articles/97-tabular/3470-filters-aren--t-applied-to-related-tables-in-power</guid>
			<description>&lt;p&gt;A colleague, with whom I work on a regular basis, recently pointed out a somewhat unexpected feature of PowerPivot PivotTables. What my colleague was seeing was that when creating a PowerPivot PivotTable, placing a column from one of the Dimension tables on rows then adding a column from a related (Parent) table in one of the slicers and selecting a specific member from the slicer the action did not apply a filter to the related dimension that had been placed on rows. When a measure was added to the PivotTable, however, the dimension that was on rows the filter was magically applied. This behavior is relatively easy to reproduce using a few tables from the Adventure Works relational database. So for those who want a reason to just play with PowerPivot (take your pick of the version), here are some relatively simple steps to reproduce the behavior.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nYPPqjFrJhbP89rgsdKAtRTLjuw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nYPPqjFrJhbP89rgsdKAtRTLjuw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nYPPqjFrJhbP89rgsdKAtRTLjuw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nYPPqjFrJhbP89rgsdKAtRTLjuw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SSAS_Articles/~4/jaEF1KT3KWo" height="1" width="1"/&gt;</description>
			<author>webadmin@ssas-info.com (John Desch)</author>
			<category>Tabular</category>
			<pubDate>Wed, 16 May 2012 22:55:16 +0000</pubDate>
		<feedburner:origLink>http://www.ssas-info.com/analysis-services-articles/97-tabular/3470-filters-aren--t-applied-to-related-tables-in-power</feedburner:origLink></item>
		<item>
			<title>Controlling the Position of Subtotals in DAX with GenerateAll()</title>
			<link>http://feedproxy.google.com/~r/SSAS_Articles/~3/9lrLutaNl3Q/3468-controlling-the-position-of-subtotals-in-dax-with-generateall</link>
			<guid isPermaLink="false">http://www.ssas-info.com/analysis-services-articles/98-tabular-dax/3468-controlling-the-position-of-subtotals-in-dax-with-generateall</guid>
			<description>&lt;p&gt;&lt;strong&gt;Reposted from &lt;a href="http://cwebbbi.wordpress.com/2012/05/15/controlling-the-position-of-subtotals-in-dax-with-generateall/" target="_blank"&gt;Chris Webb's blog&lt;/a&gt; with the author's permission. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Today I’m teaching the &lt;a href="http://www.sqlbi.com/training"&gt;SSAS 2012 Tabular workshop&lt;/a&gt; with &lt;a href="http://sqlblog.com/blogs/alberto_ferrari/"&gt;Alberto Ferrari&lt;/a&gt; in Belgium, and an interesting question came up during my session on DAX queries to do with subtotals that I couldn’t answer immediately. However, I found a solution fairly quickly afterwards and so I thought it was worth blogging about – especially since I think it’s a better solution than the one that Alberto knew about already!&lt;/p&gt;
&lt;p&gt;Consider this DAX query that runs on a table sourced from the DimDate table in Adventure Works:&lt;/p&gt;
&lt;p&gt;evaluate &lt;br /&gt;summarize( &lt;br /&gt;DimDate &lt;br /&gt;, DimDate[CalendarYear] &lt;br /&gt;, rollup(DimDate[DayNumberOfWeek]) &lt;br /&gt;, "Number of Days" &lt;br /&gt;, countrows(DimDate) &lt;br /&gt;)&lt;/p&gt;
&lt;p&gt;It returns the number of Days in the table by calendar year and day number of week – it’s very similar to a basic GROUP BY query in SQL. I blogged about this use of Summarize() and Rollup() last year &lt;a href="http://cwebbbi.wordpress.com/2011/07/15/dax-queries-part-2/"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The problem with this query is that all of the year subtotals (which appear as rows with blank values returned in the day number of week column) created by this query appear at the end of the result set, as you can see here:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://cwebbbi.files.wordpress.com/2012/05/image4.png"&gt;&lt;img src="http://cwebbbi.files.wordpress.com/2012/05/image_thumb4.png?w=371&amp;amp;h=360" border="0" alt="image" title="image" width="371" height="360" style="background-image: none; margin: 0px 5px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This isn’t very clear though. How can we put each year’s subtotal at the end of the distinct list of day numbers instead? Alberto’s solution (and I think this is the solution we’ve got in our new &lt;a href="http://www.amazon.co.uk/gp/product/0735658188/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=chriswebbsbib-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=19450&amp;amp;creativeASIN=0735658188"&gt;SSAS 2012 Tabular book&lt;/a&gt;) involves using the IsSubtotal() function (see &lt;a href="http://technet.microsoft.com/en-us/library/gg492171.aspx"&gt;here&lt;/a&gt; for more details on this) and ordering, similar to this:&lt;/p&gt;
&lt;p&gt;evaluate &lt;br /&gt;summarize( &lt;br /&gt;DimDate &lt;br /&gt;, DimDate[CalendarYear] &lt;br /&gt;, rollup(DimDate[DayNumberOfWeek]) &lt;br /&gt;, "Number of Days" &lt;br /&gt;, countrows(DimDate) &lt;br /&gt;, "Is Subtotal" &lt;br /&gt;, IsSubtotal(DimDate[DayNumberOfWeek]) &lt;br /&gt;) &lt;br /&gt;order by &lt;br /&gt;DimDate[CalendarYear] ASC &lt;br /&gt;, DimDate[DayNumberOfWeek] ASC &lt;br /&gt;, [Is Subtotal] ASC&lt;/p&gt;
&lt;p&gt;&lt;a href="http://cwebbbi.files.wordpress.com/2012/05/image5.png"&gt;&lt;img src="http://cwebbbi.files.wordpress.com/2012/05/image_thumb5.png?w=414&amp;amp;h=317" border="0" alt="image" title="image" width="414" height="317" style="background-image: none; margin: 0px 5px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;But I thought there was an alternative, more elegant approach and found one. Here it is:&lt;/p&gt;
&lt;p&gt;evaluate &lt;br /&gt;generateall( &lt;br /&gt;values(DimDate[CalendarYear]) &lt;br /&gt;, &lt;br /&gt;summarize( &lt;br /&gt;DimDate &lt;br /&gt;, rollup(DimDate[DayNumberOfWeek]) &lt;br /&gt;, "Number of Days" &lt;br /&gt;, calculate(countrows(DimDate)) &lt;br /&gt;) &lt;br /&gt;)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://cwebbbi.files.wordpress.com/2012/05/image6.png"&gt;&lt;img src="http://cwebbbi.files.wordpress.com/2012/05/image_thumb6.png?w=411&amp;amp;h=329" border="0" alt="image" title="image" width="411" height="329" style="background-image: none; margin: 0px 5px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As you can see, the subtotals appear after the list of day numbers for each year. There are two important things to understand about how this query works:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I’m using the &lt;a href="http://msdn.microsoft.com/en-us/library/gg492206.aspx"&gt;GenerateAll()&lt;/a&gt; function to take the list of distinct years returned by the Values() function and then, for each year, return a table of day numbers with a subtotal and crossjoin the result. This gives us our subtotals in the correct position without any sorting required.&lt;/li&gt;
&lt;li&gt;I had to wrap my original countrows() with calculate to make sure it returned the correct value.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;hr /&gt;
&lt;/p&gt;
&lt;table border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="http://www.ssas-info.com/images/stories/authors/chris-webb.png" border="0" alt="chris-webb" width="60" height="82" /&gt;&lt;/td&gt;
&lt;td&gt; &lt;/td&gt;
&lt;td&gt;
&lt;p&gt;Chris has been working with Microsoft BI tools since he started using beta 3 of OLAP Services back in the late 90s. Since then he has worked with Analysis Services in a number of roles (including three years spent with Microsoft Consulting Services) and he is now an independent consultant specialising in complex MDX, Analysis Services cube design and Analysis Services query performance problems. His company website can be found at &lt;a href="http://www.crossjoin.co.uk" target="_blank"&gt;http://www.crossjoin.co.uk&lt;/a&gt; and his blog can be found at &lt;a href="http://cwebbbi.wordpress.com"&gt;http://cwebbbi.wordpress.com&lt;/a&gt; .&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ZMzLdRj--eLByT63lQrQ191joFQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZMzLdRj--eLByT63lQrQ191joFQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ZMzLdRj--eLByT63lQrQ191joFQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZMzLdRj--eLByT63lQrQ191joFQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SSAS_Articles/~4/9lrLutaNl3Q" height="1" width="1"/&gt;</description>
			<author>author-chris-webb@ssas-info.com (Chris Webb)</author>
			<category>Tabular DAX</category>
			<pubDate>Wed, 16 May 2012 02:17:14 +0000</pubDate>
		<feedburner:origLink>http://www.ssas-info.com/analysis-services-articles/98-tabular-dax/3468-controlling-the-position-of-subtotals-in-dax-with-generateall</feedburner:origLink></item>
	</channel>
</rss>

