<?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>PowerPivotPro &#187; Uncategorized</title>
	<atom:link href="http://www.powerpivotpro.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.powerpivotpro.com</link>
	<description>Thoughts on PowerPivot, Sharepoint BI and the occasional movie quote</description>
	<lastBuildDate>Thu, 09 Feb 2012 07:11:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>The Greatest Formula in the World, Part Two</title>
		<link>http://www.powerpivotpro.com/2011/12/the-greatest-formula-in-the-world-part-two/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-greatest-formula-in-the-world-part-two</link>
		<comments>http://www.powerpivotpro.com/2011/12/the-greatest-formula-in-the-world-part-two/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 04:55:20 +0000</pubDate>
		<dc:creator>powerpivotpro</dc:creator>
				<category><![CDATA[Custom Calendars]]></category>
		<category><![CDATA[DAX]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PowerPivot Power Pivot Microsoft SharePoint BI Excel Business Intelligence DAX]]></category>

		<guid isPermaLink="false">http://www.powerpivotpro.com/?p=3288</guid>
		<description><![CDATA[Our Time Machine From Part 1 Needs a Couple of Fixes OK, if you recall from part one, we had a “year over year” time machine calculation going on, and it was built against a data set that lacked a “real” calendar table.&#160; Very cool.&#160; Very resourceful.&#160; And very necessary. But the time machine had [...]]]></description>
			<content:encoded><![CDATA[<h3><a href="http://troll.me/if-at-first-you-dont-succeed-build-a-time-machine-and-fix-that-shit/" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image7.png" width="314" height="314"></a></h3>
<p align="center"><strong>Our Time Machine From Part 1 Needs a Couple of Fixes</strong></p>
<p>OK, if you recall <strong><a href="http://www.powerpivotpro.com/2011/12/the-greatest-formula-in-the-world-part-one/">from part one</a></strong>, we had a “year over year” time machine calculation going on, and it was built against a data set that lacked a “real” calendar table.&nbsp; Very cool.&nbsp; Very resourceful.&nbsp; And very necessary.</p>
<p>But the time machine had two problems.&nbsp; Let’s fix them.</p>
<h3>Problem #1:&nbsp; Meaningless Grand Total</h3>
<p>Let’s start with the easy one:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image8.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="Year over year in PowerPivot - Meaningless Grand Total" border="0" alt="Year over year in PowerPivot - Meaningless Grand Total" src="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image_thumb7.png" width="206" height="434"></a></p>
<p align="center"><strong>Grand Total is Meaningless for Last Year Sales</strong></p>
<p>It is meaningless to have a “grand total” value for a measure that returns “last year’s sales.”&nbsp; What year would that BE, actually?&nbsp; It’s nonsense.&nbsp; So we use an old trick, one of the many flavors of IF(VALUES()):</p>
<p><font size="3" face="Courier New"><em><strong><font color="#0000ff">=IF(COUNTROWS(VALUES(Periods[Year]))&gt;1,BLANK(),</font></strong></em><br />&nbsp;&nbsp; CALCULATE([Total Sales], <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALL(Periods), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FILTER(ALL(Periods), Periods[Year]=MAX(Periods[Year])-1), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VALUES(Periods[MerchPeriod])<br />&nbsp;&nbsp; )<br /><em><strong><font color="#0000ff">)</font></strong></em></font></p>
<p>Where the new IF “wrapper” is highlighted and the original formula is in normal font.</p>
<p>For more on that “IF VALUES” technique, <strong><a href="http://www.powerpivotpro.com/2011/03/more-fun-with-ifvalues/">please see this post.</a></strong></p>
<p>The results are as desired, the grand total is now blank:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image9.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image_thumb8.png" width="330" height="206"></a></p>
<p>Problem solved.&nbsp; Moving on…</p>
<h3>Problem #2:&nbsp; 2011 isn’t complete but we’re getting all of 2010 sales</h3>
<p>Remember, our sales data for 2011 only goes through the first 6 months.&nbsp; So we do NOT want “last year sales” for months 7-12:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image10.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image_thumb9.png" width="280" height="299"></a></p>
<p>That can be solved a number of ways.&nbsp; The simplest is just to add another IF(), and have the Last Year Sales measure return BLANK() whenever there are no Sales:</p>
<p><font size="3" face="Courier New">=IF(COUNTROWS(VALUES(Periods[Year]))&gt;1,BLANK(),<br /><font color="#0000ff">&nbsp;&nbsp; </font><strong><em><font color="#0000ff">IF([Total Sales] = BLANK(), BLANK(),</font><br /></em></strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CALCULATE([Total Sales], <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALL(Periods), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FILTER(ALL(Periods), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Periods[Year]=MAX(Periods[Year])-1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VALUES(Periods[MerchPeriod])<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br />&nbsp; <strong><em> <font color="#0000ff">)</font><br /></em></strong>)</font></p>
<p>That trims the results to just the months desired:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image11.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image_thumb10.png" width="268" height="167"></a></p>
<p>But note that the subtotal for 2011 is still too high:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image12.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image_thumb11.png" width="262" height="444"></a></p>
<p align="center"><strong>“Last Year Sales” for 2011 Should Only be Returning <br />2010 Sales Through the First Six Months</strong></p>
<p>This one is trickier.&nbsp; I struggled to find a good answer before coming up with the following:</p>
<h3>Step 1:&nbsp; Add a “Next Year Period Num” Column to the Periods Table</h3>
<p>Recall that my Sales table has a “Period Num” column that is the basis for the relationship with the Periods table:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image13.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image_thumb12.png" width="309" height="260"></a></p>
<p>And that matches up with a similar column in the Periods table:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image14.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image_thumb13.png" width="471" height="345"></a></p>
<p>Note that Period Num does NOT reset to 1 with each new year (unlike MerchPeriod).&nbsp; So that is the absolute unique ID for a given Month/Year combo.</p>
<p>Well, I created a new column in the Periods table that tells me, for a given Period Num, what the equivalent Period Num will be NEXT year:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image15.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image_thumb14.png" width="520" height="223"></a></p>
<p>Now, in my FILTER statements, I can choose to match on THAT column instead.</p>
<h3>Bringing it Home</h3>
<p>OK, now that I have that column, I can add a new FILTER clause to my measure:</p>
<p><font size="3" face="Courier New">=IF(COUNTROWS(VALUES(Periods[Year]))&gt;1,BLANK(),</font><font size="3" face="Courier New"><br />&nbsp;&nbsp; CALCULATE([Total Sales], <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALL(Periods), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FILTER(ALL(Periods), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Periods[Year]=MAX(Periods[Year])-1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ), <br /><strong><em><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FILTER(ALL(Periods), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Periods[NextYear Period]&lt;=<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MAXX(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VALUES(PeriodSales[Period Num]), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PeriodSales[Period Num]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),</font></em></strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VALUES(Periods[MerchPeriod])<br />&nbsp;&nbsp; )<br />)</font></p>
<p>OK, what does that do?&nbsp; Simply put, it further filters the Periods table to NOT go beyond any periods for which we currently have records in the Sales table.</p>
<p>And the results:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image16.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="Last Year Sales Measure in PowerPivot With a Custom Calendar" border="0" alt="Last Year Sales Measure in PowerPivot With a Custom Calendar" src="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image_thumb15.png" width="282" height="443"></a></p>
<p align="center"><strong>Last Year Sales Measure Doing the Right Thing</strong></p>
<p>And now if you want YOY Growth, it’s straightforward:</p>
<p><font size="3" face="Courier New">=([Total Sales] &#8211; [LY Sales Finished]) / [Total Sales]</font></p>
<p>Which yields:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image17.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="Year over Year / Year on Year Growth Percentage Measure in PowerPivot With a Custom Calendar" border="0" alt="Year over Year / Year on Year Growth Percentage Measure in PowerPivot With a Custom Calendar" src="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image_thumb16.png" width="331" height="406"></a></p>
<p align="center"><strong>Year over Year / Year on Year Growth Percentage <br />Measure in PowerPivot With a Custom Calendar</strong></p>
<p>OK, I cheated and wrapped another IF(COUNTROWS(VALUES)) around the outside of the formula so that the grand total cell is blank again, because again, that’s a meaningless value to report.&nbsp; Details.</p>
<h3>Isn’t that a lot of work?</h3>
<p>Depends on how you look at it.&nbsp; First of all, it’s a lot harder to grasp the first time than it is as you get used to it, trust me.</p>
<p>But even better, this investment pays off forever.&nbsp; Normal Excel formulas may be easier to write the first time, but then you have to re-write and adjust them forever, every time your data changes.&nbsp; And every time your desired report shape changes.</p>
<p>This one is a <strong><a href="http://blogs.office.com/b/microsoft-excel/archive/2011/05/26/portable-formulas-a-powerpivot-benefit-you-ll-never-believe-you-lived-without-part-two.aspx" target="_blank">portable formula</a></strong>.&nbsp; It goes wherever you want it to go, and eats whatever data you feed it.&nbsp; Forever.&nbsp; It’s worth a little extra effort.</p>
<h3>OK but do I really have to understand all of that?</h3>
<p>No, not really.&nbsp; Not right away.&nbsp; Think of it this way:&nbsp; this is what I do all day, every day.&nbsp; And I can tell you that figuring this out is not something you want to do in your spare time.</p>
<p>But once someone gives you the pattern?&nbsp; Wash, rinse, repeat.&nbsp; Make small adjustments as needed.</p>
<p>Honestly, that whole formula above could be wrapped up in a function provided by Microsoft, and all of the nasty stuff hidden.&nbsp; I told them as much last time I visited Redmond.&nbsp; And if it were a function rather than a formula, we wouldn’t care at all how it worked. </p>
<p>So… treat this as a pattern.&nbsp; Copy/paste and modify to fit your needs.&nbsp; Seriously.</p>
<h3>Unfinished Business</h3>
<p>I actually WILL retrace my steps here though and explain a number of things though, so that you CAN understand.&nbsp; I have a couple of posts in the queue aimed at just that.</p>
<h3>Were there alternate ways to write this measure?</h3>
<p>Yes, there were, especially in that last step where I needed to get the “Last year sales” measure correct for the 2011 subtotal.&nbsp; I could have used SUMX to make the year subtotal equal to the sum of its underlying months.&nbsp; That is worthy of a post for sure.</p>
<p>But I was wondering if there was still another way.&nbsp; A way that doesn’t use SUMX and doesn’t require a new calc column.</p>
<p>And for that, we need the Italians.&nbsp; So I’m gonna try out my new toy, the Boot Signal:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image18.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.powerpivotpro.com/wp-content/uploads/2011/12/image_thumb17.png" width="444" height="345"></a></p>
<p align="center"><strong>Calling Marco and Alberto</strong></p>
<p>Get it?&nbsp; *Boot* Signal?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.powerpivotpro.com/2011/12/the-greatest-formula-in-the-world-part-two/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Off Topic:  Halloween Humor</title>
		<link>http://www.powerpivotpro.com/2011/10/off-topic-halloween-humor/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=off-topic-halloween-humor</link>
		<comments>http://www.powerpivotpro.com/2011/10/off-topic-halloween-humor/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 23:52:38 +0000</pubDate>
		<dc:creator>powerpivotpro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.powerpivotpro.com/2011/10/off-topic-halloween-humor/</guid>
		<description><![CDATA[I received this Halloween card today, thought it was hilarious, and decided to scan it in: Why exactly is that hilarious, you ask?&#160; It’s a fair question. Well, it’s funny precisely because that IS my father.&#160; And yes, he owns that suit.&#160; Not making this up. It’s even funnier because my dad is actually quite [...]]]></description>
			<content:encoded><![CDATA[<p>I received this Halloween card today, thought it was hilarious, and decided to scan it in:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/10/image42.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.powerpivotpro.com/wp-content/uploads/2011/10/image_thumb42.png" width="328" height="374"></a></p>
<p>Why exactly is that hilarious, you ask?&nbsp; It’s a fair question.</p>
<p>Well, it’s funny precisely because that IS my father.&nbsp; And yes, he owns that suit.&nbsp; Not making this up.</p>
<p>It’s even funnier because my dad is actually quite a bit “cooler” than me.&nbsp; Example: a fight broke out during a YMCA basketball game once (he and I were on the same team) and he waded into it to rescue one of our teammates, while I was getting the hell away.&nbsp; Then about 10 guys piled on my dad…&nbsp; and I decided to confuse the enemy by running away more.&nbsp; Darth Vader can fend for himself.</p>
<p>Even today, when we go places together, women who would never even acknowledge me go all giggly around him.&nbsp; He has that “cool guy” charisma.&nbsp; And a full replica Darth Vader suit.&nbsp; Yeah, even the expensive light saber:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/10/image43.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.powerpivotpro.com/wp-content/uploads/2011/10/image_thumb43.png" width="393" height="266"></a></p>
<p>Six feet, four inches of total goofball.</p>
<p>This does NOT count as Tuesday’s post, so stand by for something more meaningful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.powerpivotpro.com/2011/10/off-topic-halloween-humor/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating Accurate Percentile Measures in DAX &#8211; Part I</title>
		<link>http://www.powerpivotpro.com/2011/09/creating-accurate-percentile-measures-in-dax-%e2%80%93-part-i/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-accurate-percentile-measures-in-dax-%25e2%2580%2593-part-i</link>
		<comments>http://www.powerpivotpro.com/2011/09/creating-accurate-percentile-measures-in-dax-%e2%80%93-part-i/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 15:19:21 +0000</pubDate>
		<dc:creator>powerpivotpro</dc:creator>
				<category><![CDATA[DAX]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.powerpivotpro.com/?p=2897</guid>
		<description><![CDATA[Guest Post By Colin Banfield 29th September, 2011 Equivalents of Excel&#8217;s Percentile, Quartile, and Median functions are perhaps the most significant omissions in Denali&#8217;s DAX statistical function library. Quartile and Median are actually special cases of percentile, and in this post, we calculate these special cases. Some of the most insightful BI analysis involves the [...]]]></description>
			<content:encoded><![CDATA[<p><em>Guest Post By Colin Banfield<br /></em></p>
<p><em>29<sup>th</sup> September, 2011<br /></em></p>
<p>Equivalents of Excel&#8217;s Percentile, Quartile, and Median functions are perhaps the most significant omissions in Denali&#8217;s DAX statistical function library. Quartile and Median are actually special cases of percentile, and in this post, we calculate these special cases. Some of the most insightful BI analysis involves the use of statistics, and PowerPivot provides an excellent environment for developing statistical measures. Perhaps percentile and its cohorts will be considered for inclusion in PowerPivot V3.</p>
<p>Percentile measures are not difficult to create in DAX, but the process is also not trivial. Adding to the complexity is the need to interpolate values <em>if you want to duplicate the accuracy of Excel&#8217;s percentile functions</em>. My approach to creating percentile measures in PowerPivot is as follows:</p>
<ol>
<li>Calculate the <em>ascending rank</em> of values in the dataset under exploration.<br /> 
<li>Calculate the rank <em>corresponding to required percentile</em>. I use the formula <strong><em>n</em>=P(N-1)/100+1</strong>, where <strong><em>n</em></strong> is the rank for a given percentile <strong>P</strong>, and <strong>N</strong> is the number of rows in the dataset. This formula provides the rank corresponding to Excel&#8217;s PERCENTILE or PERCENTILE.INC function. For a calculation equivalent to Excel&#8217;s PERCENTILE.EXC, the rank for a given percentile can be found by using the formula <strong><em>n</em>=P(N+1)/100</strong>. In most cases, the rank calculated will not be an integer. Therefore, for a generalized solution, we must use the integer rank below and above the calculated value and interpolate. For example, the first formula in (1) calculates a rank of 11.25 for P=25 (25<sup>th</sup> percentile) and N=42. We must therefore interpolate between the dataset ranks of 11 and 12. <br /> 
<li>Find the <em>data values corresponding to the integer ranks</em> derived from step 2. For convenience, let&#8217;s call these values PPercentileDown and PPercentileUp.<br /> 
<li>Calculate the percentile using linear interpolation.</li>
</ol>
<p>Let&#8217;s start with a simple dataset to illustrate the concepts. In figure 1, the original dataset is in the table on the left. The corresponding PowerPivot PivotTable is on the right.</p>
<p><img alt="" src="http://www.powerpivotpro.com/wp-content/uploads/2011/09/092911_1518_CreatingAcc1.png"></p>
<p><span style="font-size: 10pt"><em>Figure 1- Original Dataset<br /></em></span></p>
<p><span style="font-family: verdana; color: #595959; font-size: 13pt"><strong>Step 1 – Calculate the ascending rank of values in the dataset</strong></span></p>
<p>Fortunately, the newly minted RANK function in Denali makes the calculation a lot easier than the <a href="http://www.powerpivotpro.com/2010/03/writing-a-rank-measure-and-living-to-tell-the-tale/">rank formula we had to create in V1</a>. The rank formula is simply:</p>
<p><span style="font-family: courier new; font-size: 10pt">=RANKX(ALL(Data),[Sum of Value],,1)<br /></span></p>
<p><img alt="" src="http://www.powerpivotpro.com/wp-content/uploads/2011/09/092911_1518_CreatingAcc2.png"></p>
<p><span style="font-size: 10pt"><em>Figure 2 – Rank Measure<br /></em></span></p>
<p><span style="font-family: verdana; color: #595959; font-size: 13pt"><strong>Step 2 &#8211; Calculate the rank corresponding to required percentile<br /></strong></span></p>
<p>We will first calculate the rank corresponding to the 25<sup>th</sup> percentile (inclusive) in the dataset. Recalling the formula <strong><em>n</em>=P(N-1)/100+1</strong>, this translates into the following DAX formula:</p>
<p><span style="font-family: courier new; font-size: 10pt">=CALCULATE(</span></p>
<blockquote><p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (COUNTROWS(Data)-1)*25/100+1,</p>
</blockquote>
<p></span><br />
<blockquote>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALL(Data)</p>
</blockquote>
<p></span>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )</p>
<p></span>
<p>In this case, the calculated rank is 11.25.</p>
<p><img alt="" src="http://www.powerpivotpro.com/wp-content/uploads/2011/09/092911_1518_CreatingAcc3.png" width="651" height="899"></p>
<p><span style="font-size: 10pt"><em>Figure 3 – Rank of 25<sup>th</sup> percentile<br /></em></span></p>
<p><span style="font-family: verdana; color: #595959; font-size: 13pt"><strong>Step 3 &#8211; Find the data values corresponding to the integer ranks derived from step 2<br /></strong></span></p>
<p>Our 25<sup>th</sup> percentile value is somewhere between the values corresponding to the 11<sup>th</sup> and 12<sup>th</sup> rank, as shown in figure 3. We need formulas to extract these values as measures. The 25thPercentileDown formula is:</p>
<p><span style="font-family: courier new; font-size: 10pt">=MAXX(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FILTER(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALL(Data), <br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Rank] = ROUNDDOWN([25PctRank_INC],0)<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ), <br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value]<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp; )<br /></span></p>
<p>We are returning the Max of Sum of Value, filtered so that [Rank] is equal to the rank of the 25<sup>th</sup> percentile, rounded down to the nearest integer rank. In other words, we are filtering the table to return only values where [Rank] = 11. In the case of ties, there will be more than one value in the filtered table (all identical). This is the reason for using MAXX. However, MINX, or even AVERAGEX would calculate the same result.</p>
<p>For 25thPercentileUp, you may be inclined to use a similar formula, substituting the ROUNDDOWN function for ROUNDUP. However, in the event of ties for the 25<sup>th</sup> percentile, the filter will be incorrect. This is so because [Rank] will calculate the same rank for ties (11 in this case), and <span style="font-family: courier new; font-size: 10pt">ROUNDUP([25PctRank_INC],0)</span>will be = 12. We can get around the problem by filtering the table using the TOPN function instead:</p>
<p><span style="font-family: courier new; font-size: 10pt">=MAXX(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TOPN(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ROUNDUP([25PctRank_INC],0),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALL(Data),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value],<br /></span></p>
<p style="margin-left: 36pt"><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp; 1<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value]<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp; )<br /></span></p>
<p>The formula simply finds the max of the top 12 values in the dataset (i.e. 11.25 rounded up to 12). The result is not affected by ties in the rank. Figure 4 shows the resultant measures.</p>
<p><img alt="" src="http://www.powerpivotpro.com/wp-content/uploads/2011/09/092911_1518_CreatingAcc4.png" width="651" height="665"></p>
<p><span style="font-size: 10pt"><em>Figure 4 – Rankup and Rankdown<br /></em></span></p>
<p><span style="font-family: verdana; color: #595959; font-size: 13pt"><strong>Step 4 &#8211; Calculate the percentile using linear interpolation<br /></strong></span></p>
<p>Now that we have the values between which we need to interpolate to find the actual percentile, we use these values in a simple interpolation formula:</p>
<p><span style="font-family: courier new; font-size: 10pt">=[25thPercentileDown]+([25thPercentileUp]-[25thPercentileDown])*([25PctRank_INC]-ROUNDDOWN([25PctRank_INC],0))<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">= 1891.07 + (2073.29-1891.07)*(11.25-11) = 1891.07 + 182.22*0.25 = 1936.63<br /></span></p>
<p>In figure 5, I&#8217;ve completed the calculations for the 50<sup>th</sup> percentile and 75<sup>th</sup> percentile and removed intermediate formulas from the PivotTable.</p>
<p><img alt="" src="http://www.powerpivotpro.com/wp-content/uploads/2011/09/092911_1518_CreatingAcc5.png" width="644" height="650"></p>
<p><em>Figure 5 – Percentiles<br /></em></p>
<p>Figure 5 illustrates that that values we calculated are identical to values calculated by using Excel&#8217;s PERCENTILE.INC function. Note that:</p>
<ul>
<li>The 25<sup>th</sup> percentile is also the first quartile<br /> 
<li>The 50<sup>th</sup> percentile is the median (i.e. the same value returned by Excel&#8217;s MEDIAN function)<br /> 
<li>The 75<sup>th</sup> percentile is also the third quartile</li>
</ul>
<p><span style="font-family: verdana; color: #595959; font-size: 13pt"><strong>Alternative median calculation</strong></span></p>
<p>If we need to calculate the median without regard for percentiles, we could use the following formula:</p>
<p><span style="font-family: courier new; font-size: 10pt">=IF(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp; MOD(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COUNTROWS(ALL(Data)),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2</span></p>
<blockquote><p><span style="font-family: courier new; font-size: 10pt">&nbsp; )=0,</p>
</blockquote>
<p></span>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp; AVERAGEX(</p>
<p></span>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TOPN(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2,<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TOPN(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (COUNTROWS(ALL(Data))/2)+1,<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALL(Data),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value],<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value]<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value]<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp; MAXX(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TOPN(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COUNTROWS(ALL(Data))/2,<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALL(Data),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value],<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value]<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp; )<br /></span></p>
<p>Essentially, we want to return the value in the middle of the range, after sorting the range in ascending order. The calculation we use depends on whether there are an even or odd number of values in our dataset. The first part of the formula, <span style="font-family: courier new; font-size: 10pt">MOD(COUNTROWS(ALL(Data)),2)=0,</span> determines if the dataset has an even number of values. I would have preferred to use ISEVEN (and thus eliminate an extra function call), but alas, Excel&#8217;s ISEVEN and ISODD functions didn&#8217;t make it into DAX.</p>
<p>If the number of values is even, we need to get the top value in the first half of the dataset, plus the next higher value (because we have to average these two values to get the median). We accomplish this goal in the following part of the formula:</p>
<p><span style="font-family: courier new; font-size: 10pt">TOPN(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp; (COUNTROWS(ALL(Data))/2)+1,<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp; ALL(Data),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value],<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp; 1<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp; )</span></p>
<p>Based on our sample dataset, the preceding formula will return a table with values where ID=1 to ID=22. Next, we get the top <strong>2</strong> values from this new table (ID=21 and ID=22). To accomplish this task, we wrap another TOPN function around the new table and sort in descending order:</p>
<p><span style="font-family: courier new; font-size: 10pt">TOPN(</span><span style="font-family: courier new; font-size: 10pt"><br /><strong>&nbsp;&nbsp;&nbsp;&nbsp; 2</strong>,<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp; TOPN(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (COUNTROWS(ALL(Data))/2)+1,<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALL(Data),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value],<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp; [Sum of Value]<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp; ),<br /></span></p>
<p>Finally, we average the two values:</p>
<p><span style="font-family: courier new; font-size: 10pt">AVERAGEX(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TOPN(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2,<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TOPN(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (COUNTROWS(ALL(Data))/2)+1,<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALL(Data),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value],<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value]<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value]<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),<br /></span></p>
<p>If the number of values in the dataset is odd, we just return the middle number, using the formula in the final argument of IF:</p>
<p><span style="font-family: courier new; font-size: 10pt">MAXX(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp; TOPN(<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COUNTROWS(ALL(Data))/2,<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALL(Data),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Sum of Value],<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp;&nbsp; [Sum of Value]<br /></span></p>
<p><span style="font-family: courier new; font-size: 10pt">&nbsp;&nbsp; )<br /></span></p>
<p>Note that TOPN rounds a number up or down <em>arithmetically</em>, if the first argument is a decimal value. Dividing an odd number by 2 will therefore always round the number to the next higher value.</p>
<p><span style="font-family: verdana; color: #595959; font-size: 13pt"><strong>Percentile INC vs. EXC</strong></span></p>
<p>At the beginning of this post, I mentioned that to compute percentiles corresponding to Excel&#8217;s PERCENTILE.EXC, you use the formula <strong><em>n</em>=P(N+1)/100</strong> to get the rank for a given percentile. When, therefore, should you use one versus the other? The answer is similar to the use of STDEV.S/STDEV.P or VAR.S/VAR.P. PERCENTILE.EXC, which is a new function in Excel 2010, generally provides better results when we are using a sample from a larger dataset (where it&#8217;s unlikely that the sample would include the dataset&#8217;s zero and one-hundredth percentile values – and thus these percentiles are <em>exc</em>luded). PERCENTILE.INC is better when we&#8217;re working with the entire dataset.</p>
<p><span style="font-family: verdana; color: #595959; font-size: 13pt"><strong>My rants of the day<br /></strong></span></p>
<p><span style="font-size: 14pt"><strong>Rant #1<br /></strong></span></p>
<p>I can&#8217;t help but end this post with a couple of rants. I&#8217;ll start with my <em>biggest irritation in all of PowerPivot</em>. <span style="background-color: yellow; text-decoration: underline"><strong>WE CAN&#8217;T HIDE MEASURES</strong></span>. That&#8217;s bold, underlined, and highlighted. This situation is quite unfortunate. Imagine if you couldn&#8217;t prevent a VBA function from surfacing in the user interface (by declaring the function as private). Imagine if you couldn&#8217;t reuse routines in your development work, but had to rewrite them over and over. Imagine if you couldn&#8217;t validate complex expressions and improve performance by maintaining intermediate formulas. Without being able to hide measures from client tools, <em>we are faced with all of the preceding issues</em>. We can hide table columns, so why are measures any different? In Analysis Services, when you create a calculated measure, you have the option to have the measure hidden or displayed in client tools. Why does this logic make sense for calculated measures in AS, but not in PowerPivot?</p>
<p>Look at my field list for percentiles in figure 6 (some not mentioned in this post):</p>
<p><img alt="" src="http://www.powerpivotpro.com/wp-content/uploads/2011/09/092911_1518_CreatingAcc6.png"></p>
<p><span style="font-size: 10pt"><em>Figure 6 – PowerPivot Field List<br /></em></span></p>
<p>Of all the measures shown, I want the client to see about half the number of measures in the list. The rest are intermediate results for<em> development purposes only</em>. To be honest, I don&#8217;t know which I find more baffling; that the development team can&#8217;t see the <em>absolute necessity</em> of this feature, or that I seem to be the only being on the planet that has a problem with this issue. Grrr. Unlike some very brilliant folks, I am unable to construct a half-page worth of a complex DAX formula, without the need to validate intermediate results.</p>
<p>On this matter, I think that I&#8217;m in good company. Flipping through the second edition of &#8220;The Microsoft Data Warehouse Toolkit,&#8221; written by authors from the highly regarded Kimball Group, I came across the following statement:</p>
<p>&#8220;<em>The best way to create calculations and measures in PowerPivot is to break long, complex formulas up into their component parts and build them incrementally. This allows you to experiment with the data and quickly see the results of your formulas.</em>&#8220;</p>
<p>Great advice, but incredibly, they don&#8217;t address how you are supposed to keep all of those intermediate results from the client&#8217;s view. The <em>only</em> solution currently available, <em>and it&#8217;s a poor one from a performance and maintenance standpoint</em>, is to merge the intermediate formulas into one mega-formula. Using perspectives don&#8217;t help either, since you can&#8217;t hide the original list of measures.</p>
<p><span style="font-size: 14pt"><strong>Rant #2<br /></strong></span></p>
<p>I&#8217;m glad to see that Denali includes TOPN, as this is a very useful function. But where is <strong>TOPNPERCENT</strong>? Can you name a product where these two functions don&#8217;t appear together, like Gemini or Siamese twins? Excel conditional formatting? Both there. Microsoft Access? Both there. T-SQL? Both there. MDX? Ditto. I find this level of inconsistency irritating. You can create a TOPN percent measure by using a formula like TOPN(COUNTROWS(Data)*N%), which is understandably trivial. Well, you can create a distinct count measure by using COUNT(DISTINCT), which is also trivial, but we now have DISTINCTCOUNT because creating distinct count measures are so common (and because the BI Pros all requested it <span style="font-family: wingdings">J</span>).</p>
<p>On the positive side, there is the &#8220;issue&#8221; of TOPN returning more than N records if there are ties in the Nth record. Microsoft&#8217;s products are somewhat varied in behavior. PowerPivot, Excel Conditional Formatting, and Access <em>always</em> return more than N values <em>if there is a tie in the Nth value</em>. MDX in Analysis Services <em>never returns more than N values</em>, so if there are ties in N, values are <em>arbitrarily</em> dropped (in contrast, SAS Analytics provides an option in MDX TopCount/BottomCount, which allows you to specify whether or not to return ties in N). T-SQL&#8217;s TOP predicate provides a WITH TIES qualifier to give you control over returning ties in value N. Personally, <em>I see no logic in dropping tied values in the Nth record</em>. Which records do you drop, and which record do you keep? Also, if there are ties in any of the values <em>within</em> the top N, all the ties are returned. Therefore, I think that PowerPivot, Excel and Access provide the correct logic.</p>
<p><span style="font-family: verdana; color: #595959; font-size: 13pt"><strong>Next…<br /></strong></span></p>
<p>In Part II, I will continue the discussion of percentiles using a slightly more complex example and demonstrate how to use percentile measures to create a box &amp; whisker PivotChart!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.powerpivotpro.com/2011/09/creating-accurate-percentile-measures-in-dax-%e2%80%93-part-i/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>A Lesson in A-G-I-L-I-T-Y</title>
		<link>http://www.powerpivotpro.com/2011/05/a-lesson-in-a-g-i-l-i-t-y/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-lesson-in-a-g-i-l-i-t-y</link>
		<comments>http://www.powerpivotpro.com/2011/05/a-lesson-in-a-g-i-l-i-t-y/#comments</comments>
		<pubDate>Wed, 11 May 2011 16:41:09 +0000</pubDate>
		<dc:creator>powerpivotpro</dc:creator>
				<category><![CDATA[Non-Football Examples]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PowerPivot Power Pivot Microsoft SharePoint BI Excel Business Intelligence Data Warehousing]]></category>

		<guid isPermaLink="false">https://powerpivotpro.wordpress.com/?p=2456</guid>
		<description><![CDATA[A case study I just have to share Over the past year, “Agility” has become quite a theme on this blog.&#160; It’s fair to say that I just keep hammering it, over and over.&#160; But I recently had my eyes opened as to what “extreme” PowerPivot agility can look like. Let’s put it in football [...]]]></description>
			<content:encoded><![CDATA[<p><img style="background-image:none;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;margin:0 7px 0 5px;" title="image" border="0" alt="image" align="left" src="http://www.powerpivotpro.com/wp-content/uploads/2011/05/image_thumb11.png" width="246" height="340" /></p>
<h3>A case study I just have to share</h3>
<p>Over the past year, “Agility” has become quite a theme on this blog.&#160; It’s fair to say that I just keep <strong><a href="http://powerpivotpro.com/2009/12/16/dax-calculate-and-rapid-iteration/">hammering</a> </strong>it, <strong><a href="http://powerpivotpro.com/2009/12/04/putting-the-intelligence-in-business-intelligence-pt-2/">over</a></strong> and <strong><a href="http://powerpivotpro.com/2011/02/19/james-bond-international-biz-intel-operative/">over</a></strong>.&#160; But I recently had my eyes opened as to what “extreme” PowerPivot agility can look like.</p>
<p>Let’s put it in football terms:&#160; it’s like I’ve been going around telling everyone how they should be less like the 400+ pound <strong><a href="http://likespor.com/wp-content/plugins/wp-o-matic/cache/d723d_aaron.jpg" target="_blank">Aaron Gibson</a></strong> and more like the nimble, versatile <strong><a href="http://www.boston.com/sports/football/patriots/extra_points/marshall-faulk.jpg" target="_blank">Marshall Faulk</a></strong>.</p>
<p>And then someone comes along like <a href="http://www.youtube.com/watch?v=hsFhZy9oxuk" target="_blank"><strong>Barry Sanders</strong></a>:<strong>&#160; </strong>agile in ways that you’d never think to recommend, but once you see it, you recognize it immediately.&#160; And then you watch it over and over in awed slow-motion (seriously, click Barry’s name above for a video).&#160; </p>
<p>That’s what this is like.</p>
<h3>Dynamic Data Warehousing!</h3>
<p>You don’t truly know what you need to know, until you are delivered what you THOUGHT you needed to know (I sound like <strong><a href="http://en.wikipedia.org/wiki/Unknown_unknown" target="_blank">Rumsfeld</a></strong>).&#160; That was the theme of <strong><a href="http://powerpivotpro.com/2010/10/12/more-powerpivot-consulting-observations/">this blog post from last year</a></strong>.&#160; That blog post concluded with my clients at the time realizing that the data they truly needed…&#160; wasn’t even being <em>collected</em>.</p>
<p>I think it’s basic human nature to assume that yesterday’s gaps in your understanding are just that (yesterday’s), and that you won’t suffer from that in the future.&#160; Marcellus Wallace recognized this tendency as pride, and rightly <strong><a href="http://www.youtube.com/watch?v=6O5BfnhmT2A" target="_blank">took a dim view of its helpfulness</a></strong>. (Video definitely NSFW!)</p>
<p>I’ve sung the praises of those folks (my clients) before, and I’m going to do it again:&#160; Pride didn’t get in the way of their thinking on this issue.&#160; Instead of telling themselves that they’d be better at anticipating their needs in the future, they decided to <em>bake uncertainty into the CORE of their BI planning.&#160; </em></p>
<p><strong>They built a system that enables the following:</strong>&#160; If they decide they are missing a set of data points, they can start collecting them, warehousing them, and analyzing them, end to end, in as little as two to four days’ time (that’s my estimate).</p>
<p>Here’s a diagram to illustrate:</p>
<p><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/05/image21.png"><img style="border-bottom:0;border-left:0;display:inline;margin-left:0;border-top:0;margin-right:0;border-right:0;" title="image" border="0" alt="image" src="http://www.powerpivotpro.com/wp-content/uploads/2011/05/image_thumb21.png" width="617" height="448" /></a> </p>
<p align="center"><strong>Click for larger version</strong></p>
<h3>More Detail</h3>
<p>Here’s some detail that was hard to fit into the diagram.&#160; Basically these folks have millions of devices out “in the wild,” and those devices are instrumented to collect data about usage patterns.&#160; When I first visited them in the early Fall, those devices were hardwired to collect only fixed data points, and we discovered that they needed to collect new data.</p>
<p>When I had the opportunity to drop back in on them recently, however, they revealed this new system.&#160; Now, the only thing hardwired is flexibility.&#160; The devices all call home once a day and see if there are new instructions awaiting them – brand new script written by their development team.&#160; To make things painless and error-free for the development team, they also have built an internal portal that the developer visits to register the new message type that they are adding to the devices’ instrumentation scripts.&#160; That portal takes care of configuring the data warehouse – new tables, retention policies, aggregation rules, as well as configuring the incoming message ports and mapping them into the right import processes.&#160; Boom.</p>
<p><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;margin:0 0 0 10px;" title="image" border="0" alt="image" align="right" src="http://www.powerpivotpro.com/wp-content/uploads/2011/05/image31.png" width="195" height="242" />They are even experimenting with ways to allow automatic generation and/or modification of PowerPivot models based on selections made in the portal.</p>
<p>It’s worth taking a step back and marveling at.&#160; On Monday they can realize they have a blind spot in their radar.&#160; On Tuesday and Wednesday they develop and test new instrumentation code.&#160; On Thursday they roll it out to the devices.&#160; And on Friday, they are literally collecting and analyzing MILLIONS of data points per day that they lacked at the beginning of the week.</p>
<p>It’s not like those new data points are on an island, either.&#160; Via DeviceID, they are linked to multiple lookup/dimension tables and therefore can be integrated into the analysis performed on other fact/data point tables as well.&#160; They can literally write measures that compare the newly-collected data against data they were already collecting – ratios, deltas, etc.&#160; They can put the new metrics side by side with old metrics in a single pivot.&#160; And, in theory, they could use the new data points to generate new lookup/dimension tables by tagging devices that exhibit high or low amounts of the newly-instrumented behaviors (although we did not discuss that on site – it just struck me as a possibility).</p>
<p>And late last year this organization had made zero investment, ZERO, in business intelligence.</p>
<h3>Can this work for everyone?</h3>
<p>Of course not.&#160; Not everyone has the luxury of reprogramming their production systems at high frequency like this.&#160; Not everyone can afford the risk or performance hit of having their production systems writing back directly to their data warehousing systems either – standard practice is to have your warehousing efforts “spying” on your transactional systems and taking occasional snapshots.&#160; It’s a pull, not a push, which is why the “E” in “ETL” is Extract.</p>
<p>But this is definitely food for thought, for everyone.&#160; “Why not?” is one of my favorite questions, because even if you can’t ultimately do something, examining the “why not” in detail is often very enlightening.</p>
<p>I know one of the standard objections is going to be, essentially, “Data Gone Wild:&#160; No discipline.&#160; Mile-long lists of tables and fields.”&#160; Bah, I say!&#160; Good problems to have!&#160; Storage is cheap, flying blind is expensive.&#160; And when you reach the point of being blinded by too much information, well, that’s an opportunity for a new set of tools and disciplines.</p>
<h3>More to come</h3>
<p>Last week was my first ever “doubleheader” – two consulting/training clients in a single week.&#160; That can be hard on a blogger, heh heh.&#160; But I look to be home for the next week or two, so you should expect to see a renewed flow of content here.&#160; Got several things rattling around in my head.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.powerpivotpro.com/2011/05/a-lesson-in-a-g-i-l-i-t-y/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Advanced DAX calculation: doing a moving grouped average in PowerPivot</title>
		<link>http://www.powerpivotpro.com/2011/03/advanced-dax-calculation-doing-a-moving-grouped-average-in-powerpivot/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=advanced-dax-calculation-doing-a-moving-grouped-average-in-powerpivot</link>
		<comments>http://www.powerpivotpro.com/2011/03/advanced-dax-calculation-doing-a-moving-grouped-average-in-powerpivot/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 13:12:39 +0000</pubDate>
		<dc:creator>Kasper de Jonge</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://powerpivotpro.com/?p=2341</guid>
		<description><![CDATA[By Kasper de Jonge, original post at PowerPivotblog.nl I got an excellent question last week on the ask my question page that brought me new understanding of DAX. So finally a new interesting (I hope) blog post on DAX. Let&#8217;s say I have a set of sales per week of a specific brand: Now I want to have the average [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_2342" class="wp-caption alignright" style="width: 310px"><a href="http://www.powerpivotpro.com/wp-content/uploads/2011/03/pulp-fiction21.jpg"><img class="size-medium wp-image-2342" title="pulp-fiction2" src="http://www.powerpivotpro.com/wp-content/uploads/2011/03/pulp-fiction21.jpg?w=300" alt="" width="300" height="225" /></a><p class="wp-caption-text">Woops I&#039;m sorry, did I change your Filter Context ? </p></div>
<p>By Kasper de Jonge, original post at <a href="http://www.powerpivotblog.nl/advanced-dax-calculation-doing-a-moving-grouped-average-in-powerpivot">PowerPivotblog.nl</a></p>
<p>I got an excellent question last week on the ask <a href="http://www.powerpivotblog.nl/ask-you-questions-here">my question page</a> that brought me new understanding of DAX. So finally a new interesting (I hope) blog post on DAX.</p>
<p>Let&#8217;s say I have a set of sales per week of a specific brand:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2011/03/table.png"><img class="alignnone size-full wp-image-2152" title="table" src="http://www.powerpivotblog.nl/wp-content/uploads/2011/03/table.png" alt="" width="300" height="231" /></a></p>
<p>Now I want to have the average of sales per week (slicable by brand) and compare it to the average of the last 3 weekly totals. I prepare  the pivottable :</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2011/03/ptable.png"><img class="alignnone size-full wp-image-2153" title="ptable" src="http://www.powerpivotblog.nl/wp-content/uploads/2011/03/ptable.png" alt="" width="509" height="192" /></a></p>
<p><span id="more-2341"></span></p>
<p>Now for the moving average of the last 3 weeks we are going to do some interesting DAX. First of all we want to use the current &#8220;Week No&#8221; as a base value, we need to check if our formula has one week in the current row context, otherwise we cannot get a moving average over a specific week. We check the number of values in the Sales[Week No] column using:</p>
<p><em>if(countrows(values(Sales[Week No])) = 1</em></p>
<p>Next we want to get the values of sales from this week and the previous two week to get a grouped average from. We can get a grouped average on Sales[Week No] of the Sales using the AVERAGEX function:</p>
<p><em>AVERAGEX(VALUES(Sales[Week No]), Sales[Sum of Sales])</em></p>
<p>Notice we use VALUES(Sales[Week No]) in function to group on the distinct values of Sales[Week No]. This function on its own will only return the average of the current Sales[Week No], we need to override the filter context to return the last current and previous two week. To override the current context with a broader set of values we can use the Calculate function.</p>
<p>This Calculate function will return a table of the current week plus the previous two:</p>
<p><em>CALCULATE(&lt;grouped AVG function&gt; , Sales[Week No] &lt;= VALUES(Sales[Week No]) &amp;&amp;  Sales[Week No] &gt; VALUES(Sales[Week No])-3)</em></p>
<p>If you combine the two we get the overall DAX function:</p>
<pre>=if(countrows(values(Sales[Week No])) = 1,
	CALCULATE(
		 AVERAGEX(VALUES(Sales[Week No]), Sales[Sum of Sales])
		 ,Sales[Week No] &lt;= VALUES(Sales[Week No]) &amp;&amp;  Sales[Week No] &gt; VALUES(Sales[Week No])-3
		)
, blank())</pre>
<p>This will give the following Pivottable:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2011/03/brand.png"><img class="alignnone size-full wp-image-2154" title="brand" src="http://www.powerpivotblog.nl/wp-content/uploads/2011/03/brand.png" alt="" width="609" height="165" /></a></p>
<p>The most interesting thing to notice here is that VALUES(Sales[Week No]) contains two different values in a single function. Let&#8217;s take a look at the DAX function again:</p>
<pre>=if(countrows(<span style="color:#ff0000;">values(Sales[Week No])</span>) = 1,
	CALCULATE(
		 AVERAGEX(<span style="color:#0000ff;">VALUES(Sales[Week No])</span>, Sales[Sum of Sales])
		 ,Sales[Week No] &lt;= <span style="color:#ff0000;">VALUES(Sales[Week No])</span> &amp;&amp;  Sales[Week No] &gt; <span style="color:#ff0000;">VALUES(Sales[Week No])</span>-3
		)
, blank())</pre>
<p>The red function will return the actual row and filter context that we are in. To see what this row and filter context is all about check this <a href="http://www.powerpivotblog.nl/what-is-that-powerpivot-pivottable-context-they-keep-talking-about">link</a>. The calculate function will change the context of the first argument, in this case we use AVERAGEX in the first argument to group on the distinct Sales[Week No] of the changed context. The blue function returns 3 Sales[Week No] to do the Average over.</p>
<p>It can look confusing but again shows the amazing capabilities of the CALCULATE and AVERAGEX functions. It took me some time to come up with CALCULATE in this particular scenario (thanks to my colleague Jeffrey who also made a <a href="http://mdxdax.blogspot.com/2011/03/logic-behind-magic-of-dax-cross-table.html">in depth blog post</a> about this subject. )</p>
]]></content:encoded>
			<wfw:commentRss>http://www.powerpivotpro.com/2011/03/advanced-dax-calculation-doing-a-moving-grouped-average-in-powerpivot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Poll:  Do you run PowerPivot for Excel on Win XP?</title>
		<link>http://www.powerpivotpro.com/2011/01/quick-poll-do-you-run-powerpivot-for-excel-on-win-xp/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quick-poll-do-you-run-powerpivot-for-excel-on-win-xp</link>
		<comments>http://www.powerpivotpro.com/2011/01/quick-poll-do-you-run-powerpivot-for-excel-on-win-xp/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 17:17:38 +0000</pubDate>
		<dc:creator>powerpivotpro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://powerpivotpro.com/?p=2132</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<a name="pd_a_4371947"></a><div class="PDS_Poll" id="PDI_container4371947" style="display:inline-block;"></div><script type="text/javascript" language="javascript" charset="utf-8" src="http://static.polldaddy.com/p/4371947.js"></script>
			<noscript>
			<a href="http://answers.polldaddy.com/poll/4371947/">View This Poll</a><br/><span style="font-size:10px;"><a href="http://polldaddy.com/features-surveys/">customer surveys</a></span>
			</noscript>
]]></content:encoded>
			<wfw:commentRss>http://www.powerpivotpro.com/2011/01/quick-poll-do-you-run-powerpivot-for-excel-on-win-xp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Tommy Chong Meme Spreads!</title>
		<link>http://www.powerpivotpro.com/2011/01/the-tommy-chong-meme-spreads/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-tommy-chong-meme-spreads</link>
		<comments>http://www.powerpivotpro.com/2011/01/the-tommy-chong-meme-spreads/#comments</comments>
		<pubDate>Sun, 09 Jan 2011 19:53:58 +0000</pubDate>
		<dc:creator>powerpivotpro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PowerPivot Power Pivot Microsoft SharePoint BI Excel Business Intelligence Donald Farmer Qliktech Qlikview]]></category>

		<guid isPermaLink="false">https://powerpivotpro.wordpress.com/2011/01/09/the-tommy-chong-meme-spreads/</guid>
		<description><![CDATA[Just a quick humorous note.&#160; Another tech blogger recently posted about Donald’s big news. Here’s a quick screenshot from that blog: What’s funny?&#160; Well, that isn’t Donald.&#160; It’s Tommy Chong.&#160; Who is the villain behind this confusion?&#160; Someone horrible, is my guess. Totally.&#160; Awesome.]]></description>
			<content:encoded><![CDATA[<p>Just a quick humorous note.&#160; Another tech blogger recently posted about <strong><a href="http://powerpivotpro.com/2011/01/06/donald-farmer-leaves-ms-for-qliktech/">Donald’s big news</a></strong>.</p>
<p>Here’s a quick screenshot from that blog:</p>
<p><img style="border-bottom:0;border-left:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;" title="image" border="0" alt="image" src="http://www.powerpivotpro.com/wp-content/uploads/2011/01/image5.png" width="334" height="308" /> </p>
<p>What’s funny?&#160; Well, that isn’t Donald.&#160; It’s Tommy Chong.&#160; Who is the villain behind this confusion?&#160; <strong><a href="http://powerpivotpro.com/2010/02/04/tommy-farmer-donny-chong-a-photo-essay/">Someone horrible</a></strong>, is my guess.</p>
<p>Totally.&#160; Awesome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.powerpivotpro.com/2011/01/the-tommy-chong-meme-spreads/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AVERAGEX &#8211; The 5-point palm, exploding fxn technique revisited</title>
		<link>http://www.powerpivotpro.com/2010/09/averagex-the-5-point-palm-exploding-fxn-technique-revisited/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=averagex-the-5-point-palm-exploding-fxn-technique-revisited</link>
		<comments>http://www.powerpivotpro.com/2010/09/averagex-the-5-point-palm-exploding-fxn-technique-revisited/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 13:16:45 +0000</pubDate>
		<dc:creator>Kasper de Jonge</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://powerpivotpro.com/?p=1951</guid>
		<description><![CDATA[By Kasper de Jonge, original post at PowerPivotblog.nl I recently had a problem that needed The 5-point palm, exploding fxn technique as described by Rob in his blog post.  I have used SUMX and COUNTX with success a few times before but this time I had a hard time getting my head around the AVERAGEX [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1952" class="wp-caption alignright" style="width: 310px"><a href="http://www.powerpivotpro.com/wp-content/uploads/2010/09/fivepoint1.jpg"><img class="size-medium wp-image-1952 " title="Fivepoint" src="http://www.powerpivotpro.com/wp-content/uploads/2010/09/fivepoint1.jpg?w=300" alt="" width="300" height="186" /></a><p class="wp-caption-text">The 5-Point palm technique is a beauty to watch, but o so lethal!</p></div>
<p>By Kasper de Jonge, original post at <a href="http://www.powerpivotblog.nl/averagex-the-5-point-palm-exploding-fxn-technique-revisited">PowerPivotblog.nl</a></p>
<p>I recently had a problem that needed The 5-point palm, exploding fxn technique as described by Rob in his <a href="http://powerpivotpro.com/2010/02/16/sumx-the-5-point-palm-exploding-fxn-technique/">blog post</a>.  I have used SUMX and COUNTX with success a few times before but this time I had a hard time getting my head around the AVERAGEX solution to my current problem.</p>
<p>While talking with Rob about it I realized I was thinking way to difficult. In this blog post I will try to make more sense of the X functions and give you a little help in building you own X function.</p>
<p>First let&#8217;s set a scenario. I want to compare the salesamount of each year to the average salesamount over the years. Sound easy huh ..</p>
<p>We start by creating a pivottable based on Contoso with CalendarYear on Y and the sum of salesamount as measure</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/09/start.png"><img class="alignnone size-full wp-image-1976" title="start" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/09/start.png" alt="" width="258" height="115" /></a></p>
<p>Next we create a measure to get the average using =AVERAGE(FactSales[SalesAmount])</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/09/start2.png"><img class="alignnone size-full wp-image-1977" title="start2" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/09/start2.png" alt="" width="387" height="115" /></a></p>
<p>hmm what happens here?  The description of the function <a href="http://technet.microsoft.com/en-us/library/ff452113.aspx">Average </a>is: &#8220;Returns the average (arithmetic mean) of all the numbers in a column.&#8221;  So what is the function will do is use the lowest grain of data and determine the average of these values, in our case this means he uses all the sales amount values from the FactSales table that are in the current context (year) to calculate the average.</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/09/low.png"><img class="alignnone size-full wp-image-1978" title="low" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/09/low.png" alt="" width="209" height="335" /></a></p>
<p>So how do we calculate the average over each year? In Excel this is easy:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/09/excel.png"><img class="alignnone size-full wp-image-1979" title="excel" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/09/excel.png" alt="" width="482" height="129" /></a></p>
<p>And in PowerPivot this is essentially the same, we can use the AVERAGEX function to calculate average over a specific table. The <a href="http://technet.microsoft.com/en-us/library/ff452181.aspx">description</a> from MSDN is:</p>
<blockquote><p>Calculates the average (arithmetic mean) of a set of expressions evaluated over a table.</p></blockquote>
<p>This means we can change the scope of the average, the normal average automatically will take the lowest grain, but now we can supply our own table it has t o calculate the average. We want the function to do the same as the Excel calculation above. Our function should do average over:</p>
<col width="92"></col>
<col width="137"></col>
<tr>
<td width="92" height="20">2007</td>
<td width="137" align="right">€ 4.561.940.955</td>
</tr>
<tr>
<td height="20">2008</td>
<td align="right">€ 4.111.233.535</td>
</tr>
<tr>
<td height="20">2009</td>
<td align="right">€ 3.740.483.119</td>
</tr>
<p>And this is exactly how the AVERAGEX should be used:</p>
<p>=AVERAGEX(all(DimDate[CalendarYear]), FactSales[Sum of SalesAmount])</p>
<p>The all(DimDate[CalendarYear]) would return a table of all years available (it even includes years that don&#8217;t have sales but this won&#8217;t alter the calculation). For each year in this table it returns the sum of salesamount, we need to use a measure here because it automatically calculates the sum no matter what context were are in. Then it uses this values of these sums to calculate an Average over.</p>
<p>The parameters are just like you say it, we want to calculate the average for each CalendarYear of Sum of SalesAmount.</p>
<p>This measure results in the following values:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/09/result.png"><img class="alignnone size-full wp-image-1980" title="result" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/09/result.png" alt="" width="562" height="136" /></a></p>
<p>The key here is the use of the first parameter supplied to the AverageX function, this is the table it will iterate over. Some other samples:<br />
I want to calculate the Average sales amount of the &#8220;Contoso Bangkok No.1 Store&#8221;, we create a table by using the FILTER function where filter all storenames by one single store.</p>
<pre>=AVERAGEX(FILTER(ALL(DimStore[StoreName]),
	DimStore[StoreName] = "Contoso Bangkok No.1 Store"),
	FactSales[Sum of SalesAmount])</pre>
<p>I want to calculate the Average sales amount of the &#8220;Contoso Bangkok No.1 Store&#8221; and &#8220;Contoso Seoul Store&#8221;:</p>
<pre>=AVERAGEX(FILTER(ALL(DimStore[StoreName]),
	DimStore[StoreName] = "Contoso Bangkok No.1 Store"
	|| DimStore[StoreName] = "Contoso Seoul Store"),
	FactSales[Sum of SalesAmount])</pre>
<p>I want to calculate the average salesamount of all years leading up to the current year. First it checks if the current year has values, 2011 doesn&#8217;t have values but is available in the dimdate table. As table we want to return all years from the dimdate table before the current year. The current year is selected by values(DimDate[CalendarYear]) because we have set CalendarYear on the y-ax.  We need to check if values returns more than one result because when the subtotal is calculated values will return all years.</p>
<pre>=IF(FactSales[Sum of SalesAmount] &gt; 0
	,AVERAGEX(
		FILTER(ALL(DimDate[CalendarYear]),
					DimDate[CalendarYear]
					&lt;= IF(countrows(VALUES(DimDate[CalendarYear])) &gt; 1
						,Blank()
						,VALUES(DimDate[CalendarYear]))
				)
		, FactSales[Sum of SalesAmount])
	, Blank())</pre>
<p>The AverageX, CountX and SumX functions are very powerful but difficult question, try to visualize what you want to do or use Excel to get the result you want and work from there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.powerpivotpro.com/2010/09/averagex-the-5-point-palm-exploding-fxn-technique-revisited/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Datamining using PowerPivot and Predixion Insight</title>
		<link>http://www.powerpivotpro.com/2010/08/datamining-using-powerpivot-and-predixion-insight/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=datamining-using-powerpivot-and-predixion-insight</link>
		<comments>http://www.powerpivotpro.com/2010/08/datamining-using-powerpivot-and-predixion-insight/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 22:29:35 +0000</pubDate>
		<dc:creator>Kasper de Jonge</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://powerpivotpro.com/?p=1883</guid>
		<description><![CDATA[By Kasper de Jonge, cross post from PowerPivotblog.nl Since this week the public beta of Predixion Software&#8217;s Data mining in the cloud for Excel is available. Those of you who are familiar with the the Microsoft SSAS Data mining Add-ins should be very comfortable with what is inside Predixion Data mining for Excel.  I have done a previous blog [...]]]></description>
			<content:encoded><![CDATA[<p>By Kasper de Jonge, cross post from <a href="http://www.powerpivotblog.nl/datamining-using-powerpivot-and-predixion-insight">PowerPivotblog.nl</a></p>
<p>Since this week the public beta of <a href="http://www.predixionsoftware.com/">Predixion Software&#8217;s</a> Data mining in the cloud for Excel is available. Those of you who are familiar with the the Microsoft SSAS Data mining Add-ins should be very comfortable with what is inside Predixion Data mining for Excel.  I have done a <a href="http://www.powerpivotblog.nl/screencast-using-datamining-with-powerpivot-in-excel">previous blog post</a> on doing data mining using PowerPivot with the MS data mining add-in where you can see how it currently works .</p>
<p>Predixion Insight for Excel is like a new version of the current SSAS add-in, the Predixion insight team consists of the folks that previously build the Add-in for MS and now started on their own.</p>
<p>The biggest change is that you no longer need an SSAS server installed. All action happens on the Predixion servers in the cloud. Second biggest (for me) is that you can use PowerPivot data as a datasource for you Data mining. Using it in combination with PowerPivot requires nothing more then Excel and a Predixion subscription for data mining. Furthermore the overal UI had been improved to make data mining a more user friendly experience. And it support 64 bits.</p>
<p>From the Predixion site:</p>
<blockquote><p>Predixion&#8217;s intuitive and easy-to-use solution allows users to run predictive analytics in the familiar environments of Microsoft Excel<sup>® </sup>and PowerPivot. Whether you are an existing SQL Server<sup>® </sup>Data Mining user, a BI specialist or a newcomer to the arena of Predictive Analytics, Predixion Insight™ will enable you to easily create, manage and run powerful and accurate predictive models without extensive training or specific knowledge of the methodologies currently required to create successful predictive projects.</p></blockquote>
<p>In this blog post we are going to see what are the key influencer are of the number of items on stock from the Contoso sample database. First we need to install the Predixion Insight for Excel, just run setup and the client will be installed within Excel. Next time you open Excel the client will be there. We have two tabs &#8220;Insight analytics&#8221;:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/ana.png"><img class="alignnone size-full wp-image-1880" title="ana" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/ana.png" alt="" width="814" height="98" /></a></p>
<p>and &#8220;Insight Now&#8221;:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/now.png"><img class="alignnone size-full wp-image-1881" title="now" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/now.png" alt="" width="650" height="90" /></a></p>
<p>The &#8220;Insight analytics&#8221; tab is mainly for the advanced data mining,the insight now enables you to get started immediately. Before we can do anything we need to connect to the predixion servers with the account we created on the website:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/conn.png"><img class="alignnone size-full wp-image-1882" title="conn" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/conn.png" alt="" width="151" height="263" /></a></p>
<p>After logging into the Predixion cloud service we can start data mining. I have loaded information from my datawarehouse in PowerPivot for Excel, i have information about my stock. I have loaded the fact table FactInventory that contains the actual nr of stock, this contains 8 million rows . The fact table is related to a lot of descriptive tables that surround the fact table, called the dimension tables. I have loaded a few of these descriptive tables into PowerPivot as well. What do we know about an item that is on stock:</p>
<ul>
<li>When was it on stock? Year/month/day</li>
<li>What Product?</li>
<li>What Productcost</li>
<li>Aging of a product in inventory</li>
<li>The Country of the store it is in.</li>
</ul>
<p>Of all these properties we want to know what influences the nr of days in stock the most. For this i want to use the &#8220;Analyze key influencers&#8221;  function. So i click on it.</p>
<p>This gives us a screen where i can select what my source is, Excel or PowerPivot, I select PowerPivot. Now i can select what table i want to analyze, i select the fact table. We could place filters here but i decided to plague the Predixion server all out with my full 8 million rows <img src='http://www.powerpivotpro.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/keyinf.png"><img class="alignnone size-full wp-image-1892" title="keyinf" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/keyinf.png" alt="" width="618" height="467" /></a></p>
<p>Next we can select the column we want to we want to determine the key influencers for:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/column.png"><img class="alignnone size-full wp-image-1893" title="column" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/column.png" alt="" width="492" height="390" /></a></p>
<p>Of course we don&#8217;t need all the columns to be analyzed, we can select the columns we want to include in our analysis:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/ana1.png"><img class="alignnone size-full wp-image-1894" title="ana" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/ana1.png" alt="" width="493" height="395" /></a></p>
<p>And this is where we notice something not right. As you can see we can select DateKey, StoreKey, ProductKey. But when we analyze this it would analyze this as a Key value, instead of Year 2009 it would test for the value 1-1-2009 and Store &#8220;Amsterdam&#8221; it would check as Integer 12. So we need to do something first, we need to prepare our PowerPivot table so that it contains descriptive values.  Luckily for us this is not that hard, just add a column in the PowerPivot field window using the =RELATED function:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/related.png"><img class="alignnone size-full wp-image-1895" title="related" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/related.png" alt="" width="483" height="367" /></a></p>
<p>Now we can select these columns in the data mining add in:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/cols2.png"><img class="alignnone size-full wp-image-1896" title="cols2" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/cols2.png" alt="" width="500" height="402" /></a></p>
<p>Now we are good to go, just click Run and the data mining will be started.</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/start.png"><img class="alignnone size-full wp-image-1897" title="start" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/start.png" alt="" width="409" height="253" /></a></p>
<p>The great thing here is that everything happens on the server, i can start multiple operations at the same time. And of course it being in the cloud i can open this up on another machine and immediately access the results.</p>
<p>One thing i noted is that the information is send to the cloud through an encrypted tunnel so no worry your data can be read while sniffing your network.</p>
<p>When i click on Minimize to Task pane you will see a new Predixion pane will show up where you can see all your tasks:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/pane.png"><img class="alignnone size-full wp-image-1898" title="pane" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/pane.png" alt="" width="314" height="349" /></a></p>
<p>As you can see i ran this demo before so i can use these results to show the result of the mining Predixion did, just click &#8220;Results&#8221; and the report below appears:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/report.png"><img class="alignnone size-full wp-image-1899" title="report" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/report.png" alt="" width="731" height="569" /></a></p>
<p>As you can see it is pretty easy to combine the information you have in PowerPivot with the enormous powers of data mining. The new user interface and the availability of the Predixion servers in the cloud really make data mining available for anyone. Just as PowerPivot makes data analytics available for everyone. The Predixion Insight for Excel works with Excel 2007 and Excel 2010 32 AND 64 bit, of course PowerPivot won&#8217;t be available with Excel 2007.</p>
<p>Predixion Insight is also working on a on-premise and dedicated off-site cloud solution which leverages SQL Server, SSAS and SharePoint which they call Enterprise Insight.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.powerpivotpro.com/2010/08/datamining-using-powerpivot-and-predixion-insight/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Combine two data sources (in our case ssas) using PowerPivot</title>
		<link>http://www.powerpivotpro.com/2010/08/combine-two-data-sources-in-our-case-ssas-using-powerpivot/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=combine-two-data-sources-in-our-case-ssas-using-powerpivot</link>
		<comments>http://www.powerpivotpro.com/2010/08/combine-two-data-sources-in-our-case-ssas-using-powerpivot/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 18:08:18 +0000</pubDate>
		<dc:creator>Kasper de Jonge</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://powerpivotpro.com/?p=1840</guid>
		<description><![CDATA[By Kasper de Jonge, crosspost from PowerPivotblog.nl As part of our PowerPivot for the regular Information worker today a blog post on how to use PowerPivot to combine information from two sources into a single information product. In our case the information is stored inside two analysis services cubes that the BI department had made accessible to us. [...]]]></description>
			<content:encoded><![CDATA[<p>By Kasper de Jonge, crosspost from <a href="http://www.powerpivotblog.nl">PowerPivotblog.nl</a></p>
<p>As part of our <a href="http://powerpivotpro.com/2010/07/22/an-xl-pros-plea-for-more-xl-pro-focused-content/" target="_blank">PowerPivot for the regular Information worker</a> today a blog post on how to use PowerPivot to combine information from two sources into a single information product.</p>
<p>In our case the information is stored inside two analysis services cubes that the BI department had made accessible to us.</p>
<p>We want to analyze the order amount per product, year, month and country we have in one cube with the actual order count we have in another cube.</p>
<p>We start by importing the information from both cubes into PowerPivot, make sure both tables contain the same columns you want to analyze against.</p>
<p>We use the &#8220;From database&#8221;, &#8220;From analysis services&#8221; to select the analysis service and cube we want to import from. After that we can select the data to import:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/ssas1.png"><img class="alignnone size-full wp-image-1844" title="ssas1" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/ssas1.png" alt="" width="624" height="417" /></a></p>
<p>Same for the second cube:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/ssas2.png"><img class="alignnone size-full wp-image-1845" title="ssas2" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/ssas2.png" alt="" width="628" height="426" /></a></p>
<p>The data from both cubes are loaded into two seperate tables. We want to combine the two tables. To do that we can create a relationship between the tables, for more information read <a href="http://www.powerpivotblog.nl/combine-two-files-or-fact-tables-in-powerpivot-using-relationships-relationships-explained">a previous blogpost on relationships</a>. First thing we need to do is make sure that all the columns are identical. As you can see in the screenshots above the month and year columns from both tables do not contain the same values.</p>
<p>We start by creating a new calculated column in which we use DAX to get only the last 4 numbers and create a new year column</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/year.png"><img class="alignnone size-full wp-image-1846" title="year" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/year.png" alt="" width="432" height="240" /></a></p>
<p>The next one is a little harder, the monthscolumn from one cube contain only the names of the months instead of the numbers. To translate the monthname to a monthnumber i created a translation table in excel and loaded it into PowerPivot:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/table.png"><img class="alignnone size-full wp-image-1847" title="table" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/table.png" alt="" width="395" height="175" /></a></p>
<p>next i created a relationship between the table and the translation table:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/relationship.png"><img class="alignnone size-full wp-image-1848" title="relationship" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/relationship.png" alt="" width="513" height="333" /></a></p>
<p>Now we are able to use the translated values in our table to create a new column using DAX, using the function RELATED we can get the value from the translation table in each row:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/month.png"><img class="alignnone size-full wp-image-1849" title="month" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/month.png" alt="" width="424" height="251" /></a></p>
<p>To make sure we can create a relationship we need a unique key in each table to connect a row from one table to a row from the other table. Again for more information check out <a href="http://www.powerpivotblog.nl/combine-two-files-or-fact-tables-in-powerpivot-using-relationships-relationships-explained">my previous blogpost on relationships</a>.</p>
<p>A row is uniquely identified by the values of all the columns from a row. SSAS will make sure a row is returned once for each measure because it automatically aggregates rows. So all we need to do now is combine the values from all the columns into a new column and connect the two tables by creating a relationship.</p>
<p>First we create a new column we call Key in both tables using the &amp;-sign or use the Concat function:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/relationcrea.png"><img class="alignnone size-full wp-image-1850" title="relationcrea" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/relationcrea.png" alt="" width="596" height="301" /></a></p>
<p>Then we create a relationship between the two:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/rel21.png"><img class="alignnone size-full wp-image-1854" title="rel2" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/rel21.png" alt="" width="584" height="288" /></a><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/rel2.png"></a></p>
<p>Now we have prepared the the data we can use it into the PowerPivot pivottable, you can see we can use the measure from both cubes in one table:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/pivottable.png"><img class="alignnone size-full wp-image-1853" title="pivottable" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/pivottable.png" alt="" width="613" height="345" /></a></p>
<p>What is important to notice is that I use columns from the table I indicated as lookup table as filter / slicer / row label. When i would have used the other table we only would have had measure from the orderamount table.</p>
<p>To make it a little easier to use i would recommend to hide the columns from the orderamount table in our pivottable. Go to the table, click design, click hide and unhide.</p>
<p>Here you can hide columns from the pivottable, in our case we only want to keep the measure value in the pivottable:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/hide-column.png"><img class="alignnone size-full wp-image-1855" title="hide column" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/hide-column.png" alt="" width="420" height="298" /></a></p>
<p>This will give us only the cleaned up colums in our PowerPivot Field list:</p>
<p><a href="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/cleared.png"><img class="alignnone size-full wp-image-1856" title="cleared" src="http://www.powerpivotblog.nl/wp-content/uploads/2010/08/cleared.png" alt="" width="615" height="321" /></a></p>
<p>As you can see combining data from two cubes is not that hard, important is identifying  a key column between the two tables. You need to keep this in mind when importing data from cubes to combine them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.powerpivotpro.com/2010/08/combine-two-data-sources-in-our-case-ssas-using-powerpivot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

