<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Last Ever Non Empty &#8211; a new, fast MDX approach</title>
	<atom:link href="http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/feed/" rel="self" type="application/rss+xml" />
	<link>http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/</link>
	<description>Analysis Services, MDX, PowerPivot, DAX and anything BI-related</description>
	<lastBuildDate>Sat, 18 May 2013 22:38:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Chris Webb</title>
		<link>http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9601</link>
		<dc:creator><![CDATA[Chris Webb]]></dc:creator>
		<pubDate>Wed, 10 Apr 2013 02:29:11 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9601</guid>
		<description><![CDATA[What you will need to do I think is to use a scoped assignment to perform the last ever nonempty calculation at the Contract level as well, and then the results of the calculation will aggregate up in the way you expect.]]></description>
		<content:encoded><![CDATA[<p>What you will need to do I think is to use a scoped assignment to perform the last ever nonempty calculation at the Contract level as well, and then the results of the calculation will aggregate up in the way you expect.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Srivathsan Badrinarayanan</title>
		<link>http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9600</link>
		<dc:creator><![CDATA[Srivathsan Badrinarayanan]]></dc:creator>
		<pubDate>Tue, 09 Apr 2013 21:20:03 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9600</guid>
		<description><![CDATA[Thanks for replying for my questions. I did changes for Last Ever Non Empty and am showing an example with before and after change.

BEFORE
Row Labels	201301	201302	201303	201304	Grand Total
-----------------------------------------------------------------------------------------
Contract-1	 750				                                   750
Contract-2		          3,000	3,000	 3,000	   3,000
--------------------------------------------------------------------------------------
Grand Total	750	         3,000	3,000	 3,000	   3,000
----------------------------------------------------------------------------------------

AFTER
Row Labels	201301	201302	201303	201304	Grand Total
----------------------------------------------------------------------------------------
Contract-1	  750	 750	         750	          750	  750
Contract-2	  3,000	3,000	3,000	3,000         3,000
------------------------------------------------------------------------------------
Grand Total	 750  	3,000	3,000	3,000	3,000
------------------------------------------------------------------------------------
Expected	         750	        3,750	3,750	3,750	3,750
Grand Total
-----------------------------------------------------------------------------------------

We are expecting 3,750 as Grand Total , but still its showing 3,000.
I can show screenshot of these exmples in my cube , but the reply option is not allowing attachments.

Is there any way we can get the Grand Total corrected ?]]></description>
		<content:encoded><![CDATA[<p>Thanks for replying for my questions. I did changes for Last Ever Non Empty and am showing an example with before and after change.</p>
<p>BEFORE<br />
Row Labels	201301	201302	201303	201304	Grand Total<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Contract-1	 750				                                   750<br />
Contract-2		          3,000	3,000	 3,000	   3,000<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Grand Total	750	         3,000	3,000	 3,000	   3,000<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>AFTER<br />
Row Labels	201301	201302	201303	201304	Grand Total<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Contract-1	  750	 750	         750	          750	  750<br />
Contract-2	  3,000	3,000	3,000	3,000         3,000<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Grand Total	 750  	3,000	3,000	3,000	3,000<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Expected	         750	        3,750	3,750	3,750	3,750<br />
Grand Total<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>We are expecting 3,750 as Grand Total , but still its showing 3,000.<br />
I can show screenshot of these exmples in my cube , but the reply option is not allowing attachments.</p>
<p>Is there any way we can get the Grand Total corrected ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Webb</title>
		<link>http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9596</link>
		<dc:creator><![CDATA[Chris Webb]]></dc:creator>
		<pubDate>Tue, 09 Apr 2013 02:07:40 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9596</guid>
		<description><![CDATA[Hmm, can you give me a specific example of what&#039;s happening and what you would like to happen?]]></description>
		<content:encoded><![CDATA[<p>Hmm, can you give me a specific example of what&#8217;s happening and what you would like to happen?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Srivathsan Badrinarayanan</title>
		<link>http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9595</link>
		<dc:creator><![CDATA[Srivathsan Badrinarayanan]]></dc:creator>
		<pubDate>Tue, 09 Apr 2013 01:56:49 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9595</guid>
		<description><![CDATA[Hi Magi, Did you get any working solution for Grand Total ? I am facing the same issue and need help. Thanks in advance]]></description>
		<content:encoded><![CDATA[<p>Hi Magi, Did you get any working solution for Grand Total ? I am facing the same issue and need help. Thanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Srivathsan Badrinarayanan</title>
		<link>http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9594</link>
		<dc:creator><![CDATA[Srivathsan Badrinarayanan]]></dc:creator>
		<pubDate>Tue, 09 Apr 2013 01:55:42 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9594</guid>
		<description><![CDATA[Hi Chris, Thanks for this great solution. I have question on grand total.  Grand Total is still showing total based on Last Non Empty. Is there any way to show grand total including the last ever non empty value ? this question is similar to Magi question on March 16 2013. An answer will help a lot.
Thanks in advance.]]></description>
		<content:encoded><![CDATA[<p>Hi Chris, Thanks for this great solution. I have question on grand total.  Grand Total is still showing total based on Last Non Empty. Is there any way to show grand total including the last ever non empty value ? this question is similar to Magi question on March 16 2013. An answer will help a lot.<br />
Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Webb</title>
		<link>http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9549</link>
		<dc:creator><![CDATA[Chris Webb]]></dc:creator>
		<pubDate>Fri, 29 Mar 2013 21:50:23 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9549</guid>
		<description><![CDATA[Thinking about it, you could replace the IIF() with [Fiscal Calendar].[Fiscal Calendar].CURRENTMEMBER.LEVEL.MEMBERS.ITEM() - it would be more concise, but may or may not perform better.]]></description>
		<content:encoded><![CDATA[<p>Thinking about it, you could replace the IIF() with [Fiscal Calendar].[Fiscal Calendar].CURRENTMEMBER.LEVEL.MEMBERS.ITEM() &#8211; it would be more concise, but may or may not perform better.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Ross</title>
		<link>http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9538</link>
		<dc:creator><![CDATA[Christopher Ross]]></dc:creator>
		<pubDate>Thu, 28 Mar 2013 21:38:08 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9538</guid>
		<description><![CDATA[I was just hoping to simplify the code IIF in to something that would sort of traverse the hierarchy and use the level corresponding to the level of the currentmember, but if that&#039;s not possible all is well!

Thx Chris,
Chris]]></description>
		<content:encoded><![CDATA[<p>I was just hoping to simplify the code IIF in to something that would sort of traverse the hierarchy and use the level corresponding to the level of the currentmember, but if that&#8217;s not possible all is well!</p>
<p>Thx Chris,<br />
Chris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Webb</title>
		<link>http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9494</link>
		<dc:creator><![CDATA[Chris Webb]]></dc:creator>
		<pubDate>Mon, 25 Mar 2013 17:19:39 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9494</guid>
		<description><![CDATA[Hi Chris,

What exactly do you want to improve here? The nested IIFs could be replaced by a CASE statement or (even better) a scoped assignment, but I&#039;m not sure if that would improve performance (if that&#039;s your problem).

Chris]]></description>
		<content:encoded><![CDATA[<p>Hi Chris,</p>
<p>What exactly do you want to improve here? The nested IIFs could be replaced by a CASE statement or (even better) a scoped assignment, but I&#8217;m not sure if that would improve performance (if that&#8217;s your problem).</p>
<p>Chris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Ross</title>
		<link>http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9493</link>
		<dc:creator><![CDATA[Chris Ross]]></dc:creator>
		<pubDate>Mon, 25 Mar 2013 12:12:58 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9493</guid>
		<description><![CDATA[Thanks for this, I learned some useful methods! I have put it to method in one instance but am thinking you may have an idea how to improve it. In particular I want to make the formula work for a user browsing a relatively complete calendar hierarchy. Thoughts? The part I want to improve is the conditions in LastMovement:

WITH
MEMBER MEASURES.MaxDate AS 
MAX(NULL:[Fiscal Calendar].[Fiscal Calendar].CURRENTMEMBER
	, IIF(
		[Measures].[Avg Stock Age]=0  
		,NULL
		, COUNT(NULL:[Fiscal Calendar].[Fiscal Calendar].CURRENTMEMBER)
	)
)

MEMBER CalendarLevel AS [Fiscal Calendar].[Fiscal Calendar].CURRENTMEMBER.LEVEL.ORDINAL

MEMBER MEASURES.LastMovement AS
IIF(
	ISEMPTY(MEASURES.MaxDate)
	, NULL
	, ([Measures].[Avg Stock Age],
		IIF(CalendarLevel = 4
			,[Fiscal Calendar].[Fiscal Week].MEMBERS.ITEM(MEASURES.MAXDATE)
			, IIF(CalendarLevel = 3
				, [Fiscal Calendar].[Fiscal Month].MEMBERS.ITEM(MEASURES.MAXDATE)
				, IIF(CalendarLevel = 2
					, [Fiscal Calendar].[Fiscal Quarter].MEMBERS.ITEM(MEASURES.MAXDATE)
					, NULL
				)
			)
		)
	)
)

, FORMAT_STRING = &#039;#,#&#039;


 SELECT NON EMPTY {MaxDate
 , [Measures].LastMovement
 , [Measures].[Avg Stock Age]
  } ON COLUMNS
 , NON EMPTY (
	[Stock].[Business].[Stock Name].&amp;[1000000002225]
	, {[Fiscal Calendar].[Fiscal Calendar].[Fiscal Week].&amp;[315]:
		[Fiscal Calendar].[Fiscal Calendar].[Fiscal Week].&amp;[309]
		 } 
	) ON ROWS
FROM [Sales]]]></description>
		<content:encoded><![CDATA[<p>Thanks for this, I learned some useful methods! I have put it to method in one instance but am thinking you may have an idea how to improve it. In particular I want to make the formula work for a user browsing a relatively complete calendar hierarchy. Thoughts? The part I want to improve is the conditions in LastMovement:</p>
<p>WITH<br />
MEMBER MEASURES.MaxDate AS<br />
MAX(NULL:[Fiscal Calendar].[Fiscal Calendar].CURRENTMEMBER<br />
	, IIF(<br />
		[Measures].[Avg Stock Age]=0<br />
		,NULL<br />
		, COUNT(NULL:[Fiscal Calendar].[Fiscal Calendar].CURRENTMEMBER)<br />
	)<br />
)</p>
<p>MEMBER CalendarLevel AS [Fiscal Calendar].[Fiscal Calendar].CURRENTMEMBER.LEVEL.ORDINAL</p>
<p>MEMBER MEASURES.LastMovement AS<br />
IIF(<br />
	ISEMPTY(MEASURES.MaxDate)<br />
	, NULL<br />
	, ([Measures].[Avg Stock Age],<br />
		IIF(CalendarLevel = 4<br />
			,[Fiscal Calendar].[Fiscal Week].MEMBERS.ITEM(MEASURES.MAXDATE)<br />
			, IIF(CalendarLevel = 3<br />
				, [Fiscal Calendar].[Fiscal Month].MEMBERS.ITEM(MEASURES.MAXDATE)<br />
				, IIF(CalendarLevel = 2<br />
					, [Fiscal Calendar].[Fiscal Quarter].MEMBERS.ITEM(MEASURES.MAXDATE)<br />
					, NULL<br />
				)<br />
			)<br />
		)<br />
	)<br />
)</p>
<p>, FORMAT_STRING = &#8216;#,#&#8217;</p>
<p> SELECT NON EMPTY {MaxDate<br />
 , [Measures].LastMovement<br />
 , [Measures].[Avg Stock Age]<br />
  } ON COLUMNS<br />
 , NON EMPTY (<br />
	[Stock].[Business].[Stock Name].&amp;[1000000002225]<br />
	, {[Fiscal Calendar].[Fiscal Calendar].[Fiscal Week].&amp;[315]:<br />
		[Fiscal Calendar].[Fiscal Calendar].[Fiscal Week].&amp;[309]<br />
		 }<br />
	) ON ROWS<br />
FROM [Sales]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Magi</title>
		<link>http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9416</link>
		<dc:creator><![CDATA[Magi]]></dc:creator>
		<pubDate>Sat, 16 Mar 2013 09:08:00 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/#comment-9416</guid>
		<description><![CDATA[Hi Chriss,

Thank you for this useful post! It really helps a lot, especially in cases of balances, investments, and other financal scenarios like the one I work on. 
I am using your solution and it works great, if the cube is sliced on Time dimension. The only problem comes with Grand Totals, and I really can&#039;t understand how to resolve it, so I will greatly appreciate your help. The Grand Total sum by rows is correct (or I should say works as expected), but if you look at column Grand Total, Totals are SUMs until there are sales data, when there are no last sale for the period, then the Total is not SUM but Last Non Empty. I.e. Grand Total for 2004 and 2006 is 2643.61, which is not as expected. The same is appearing when for example the Year is on column, but the Cutomer is on Rows, then the Row Totals should be SUM, but they are &quot;partially&quot; sum and partially LastNonEmpty. 
So I suppose my question is how to correct/control or replace those totals?
Thank you a lot!]]></description>
		<content:encoded><![CDATA[<p>Hi Chriss,</p>
<p>Thank you for this useful post! It really helps a lot, especially in cases of balances, investments, and other financal scenarios like the one I work on.<br />
I am using your solution and it works great, if the cube is sliced on Time dimension. The only problem comes with Grand Totals, and I really can&#8217;t understand how to resolve it, so I will greatly appreciate your help. The Grand Total sum by rows is correct (or I should say works as expected), but if you look at column Grand Total, Totals are SUMs until there are sales data, when there are no last sale for the period, then the Total is not SUM but Last Non Empty. I.e. Grand Total for 2004 and 2006 is 2643.61, which is not as expected. The same is appearing when for example the Year is on column, but the Cutomer is on Rows, then the Row Totals should be SUM, but they are &#8220;partially&#8221; sum and partially LastNonEmpty.<br />
So I suppose my question is how to correct/control or replace those totals?<br />
Thank you a lot!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
