<?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: Scoped Assignments and Multiselect</title>
	<atom:link href="http://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/feed/" rel="self" type="application/rss+xml" />
	<link>http://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/</link>
	<description>Analysis Services, MDX, PowerPivot, DAX and anything BI-related</description>
	<lastBuildDate>Fri, 24 May 2013 09:55:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: hyang</title>
		<link>http://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-3791</link>
		<dc:creator><![CDATA[hyang]]></dc:creator>
		<pubDate>Mon, 09 Jul 2012 12:45:31 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-3791</guid>
		<description><![CDATA[Chris,

I reviewed the video, found my problem. 

thank you for your reply and your video!]]></description>
		<content:encoded><![CDATA[<p>Chris,</p>
<p>I reviewed the video, found my problem. </p>
<p>thank you for your reply and your video!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Webb</title>
		<link>http://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-3753</link>
		<dc:creator><![CDATA[Chris Webb]]></dc:creator>
		<pubDate>Mon, 02 Jul 2012 22:26:43 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-3753</guid>
		<description><![CDATA[Is [Date].[Calendar] a user hierarchy? Can you try scoping on the attribute hierarchy used to build that level instead?]]></description>
		<content:encoded><![CDATA[<p>Is [Date].[Calendar] a user hierarchy? Can you try scoping on the attribute hierarchy used to build that level instead?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hua Yang</title>
		<link>http://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-3751</link>
		<dc:creator><![CDATA[Hua Yang]]></dc:creator>
		<pubDate>Mon, 02 Jul 2012 19:53:32 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-3751</guid>
		<description><![CDATA[Hi Chris,
I watched your video &quot;fun with scope assignment on SQLbits.com. It is very helpful, I have better understand the scope statement than before.  
But I have hard time to understand  the problem below. 
The first scope statement works just fine; in the second statement I change to use data range to replace the calendar year, it return empty. I cannot figure out why. Can you please help?

scope([Date].[Calendar].[Calendar Year].&amp;[2011]);

    scope([Measures].[Most Frequent Price1]);
       This=topcount(
                       [Price].[Price].[Price].MEMBERS,                                              
                         1,
                   [Measures].[Invoice Transaction Count]
                 ).Item(0).ITEM(0).MemberValue;
                            
    end scope;
end scope;


scope([Date].[Calendar].[Date].&amp;[20110101]:[Date].[Calendar].[Date].&amp;[20111231]);

    scope([Measures].[Most Frequent Price1]);
       This=topcount(
                       [Price].[Price].[Price].MEMBERS,                                              
                         1,
                   [Measures].[Invoice Transaction Count]
                 ).Item(0).ITEM(0).MemberValue;
                            
    end scope
end scope


thanks
Hua]]></description>
		<content:encoded><![CDATA[<p>Hi Chris,<br />
I watched your video &#8220;fun with scope assignment on SQLbits.com. It is very helpful, I have better understand the scope statement than before.<br />
But I have hard time to understand  the problem below.<br />
The first scope statement works just fine; in the second statement I change to use data range to replace the calendar year, it return empty. I cannot figure out why. Can you please help?</p>
<p>scope([Date].[Calendar].[Calendar Year].&amp;[2011]);</p>
<p>    scope([Measures].[Most Frequent Price1]);<br />
       This=topcount(<br />
                       [Price].[Price].[Price].MEMBERS,<br />
                         1,<br />
                   [Measures].[Invoice Transaction Count]<br />
                 ).Item(0).ITEM(0).MemberValue;</p>
<p>    end scope;<br />
end scope;</p>
<p>scope([Date].[Calendar].[Date].&amp;[20110101]:[Date].[Calendar].[Date].&amp;[20111231]);</p>
<p>    scope([Measures].[Most Frequent Price1]);<br />
       This=topcount(<br />
                       [Price].[Price].[Price].MEMBERS,<br />
                         1,<br />
                   [Measures].[Invoice Transaction Count]<br />
                 ).Item(0).ITEM(0).MemberValue;</p>
<p>    end scope<br />
end scope</p>
<p>thanks<br />
Hua</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Webb</title>
		<link>http://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-3443</link>
		<dc:creator><![CDATA[Chris Webb]]></dc:creator>
		<pubDate>Sat, 28 Apr 2012 19:40:30 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-3443</guid>
		<description><![CDATA[It&#039;s hard to say - I&#039;d probably need to spend about an hour looking at your cube and attribute relationships doing some tests before I could be sure why that was happening.]]></description>
		<content:encoded><![CDATA[<p>It&#8217;s hard to say &#8211; I&#8217;d probably need to spend about an hour looking at your cube and attribute relationships doing some tests before I could be sure why that was happening.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ram</title>
		<link>http://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-3438</link>
		<dc:creator><![CDATA[ram]]></dc:creator>
		<pubDate>Sat, 28 Apr 2012 05:59:48 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-3438</guid>
		<description><![CDATA[Hi Chris,

 This is in reference to the post http://social.technet.microsoft.com/Forums/en-US/sqlanalysisservices/thread/e0a4975f-8f19-40d0-90ff-4fcca1d301c1

Thanks for your help and I was able to solve the issue. Here is the modified code

CREATE MEMBER CURRENTCUBE.[Measures].[SalesAmount]
 AS 
null, 
FORMAT_STRING = &quot;0&quot;, 
VISIBLE = 1  ;

/* When the channel is at all Level and when a region is selected show region data */
SCOPE([In Market Channel].[InMarketChannelAttr].[All Channels],[In Market Region].[InMarketRegionAttr].members);
[Measures].[SalesAmount]=[Measures].[Re Sales Amount];
END SCOPE;

/* When the channel is at all Level and when all region  show channel data */
SCOPE([In Market Channel].[InMarketChannelAttr].[All Channels],[In Market Region].[InMarketRegionAttr].[All Regions]);
[Measures].[SalesAmount]=[Measures].[Ch Sales Amount];
END SCOPE;



CREATE MEMBER CURRENTCUBE.[Measures].[TotalAmount]
 AS 
[Measures].[SalesAmount], 
FORMAT_STRING = &quot;0&quot;, 
VISIBLE = 1  ;

However I do find one scenario , If I change the Scope statements i.e. If I add the second scope statement at the first place and when I select multiple regions, I am encountering the same issue. However If I first write the scope of region members and then add a scope for all region member then it works fine.
Please let me know why the behaviour. I have no clue why this is happening.

Thanks once again !]]></description>
		<content:encoded><![CDATA[<p>Hi Chris,</p>
<p> This is in reference to the post <a href="http://social.technet.microsoft.com/Forums/en-US/sqlanalysisservices/thread/e0a4975f-8f19-40d0-90ff-4fcca1d301c1" rel="nofollow">http://social.technet.microsoft.com/Forums/en-US/sqlanalysisservices/thread/e0a4975f-8f19-40d0-90ff-4fcca1d301c1</a></p>
<p>Thanks for your help and I was able to solve the issue. Here is the modified code</p>
<p>CREATE MEMBER CURRENTCUBE.[Measures].[SalesAmount]<br />
 AS<br />
null,<br />
FORMAT_STRING = &#8220;0&#8243;,<br />
VISIBLE = 1  ;</p>
<p>/* When the channel is at all Level and when a region is selected show region data */<br />
SCOPE([In Market Channel].[InMarketChannelAttr].[All Channels],[In Market Region].[InMarketRegionAttr].members);<br />
[Measures].[SalesAmount]=[Measures].[Re Sales Amount];<br />
END SCOPE;</p>
<p>/* When the channel is at all Level and when all region  show channel data */<br />
SCOPE([In Market Channel].[InMarketChannelAttr].[All Channels],[In Market Region].[InMarketRegionAttr].[All Regions]);<br />
[Measures].[SalesAmount]=[Measures].[Ch Sales Amount];<br />
END SCOPE;</p>
<p>CREATE MEMBER CURRENTCUBE.[Measures].[TotalAmount]<br />
 AS<br />
[Measures].[SalesAmount],<br />
FORMAT_STRING = &#8220;0&#8243;,<br />
VISIBLE = 1  ;</p>
<p>However I do find one scenario , If I change the Scope statements i.e. If I add the second scope statement at the first place and when I select multiple regions, I am encountering the same issue. However If I first write the scope of region members and then add a scope for all region member then it works fine.<br />
Please let me know why the behaviour. I have no clue why this is happening.</p>
<p>Thanks once again !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Webb</title>
		<link>http://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-2625</link>
		<dc:creator><![CDATA[Chris Webb]]></dc:creator>
		<pubDate>Fri, 28 Oct 2011 20:54:01 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-2625</guid>
		<description><![CDATA[With a subselect I would expect to get the All Member value back - a subselect doesn&#039;t alter the currentmember, only a where clause does. Also, are you using a user hierarchy (as opposed to an attribute hierarchy) for your tests?]]></description>
		<content:encoded><![CDATA[<p>With a subselect I would expect to get the All Member value back &#8211; a subselect doesn&#8217;t alter the currentmember, only a where clause does. Also, are you using a user hierarchy (as opposed to an attribute hierarchy) for your tests?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Stephens</title>
		<link>http://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-2621</link>
		<dc:creator><![CDATA[Paul Stephens]]></dc:creator>
		<pubDate>Fri, 28 Oct 2011 15:54:44 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-2621</guid>
		<description><![CDATA[Chris,

I recreated your experiment and I see similar results but with a couple of exceptions noted below.  I &#039;d like to know the rules that are in effect here if anyone can offer an explanation. We are struggling with a couple of our scoped measures and this might help explain the results we are seeing.
Thanks,
Paul


CREATE MEMBER CURRENTCUBE.[Measures].[TESTCALC] AS 1; 

SCOPE([Measures].[TESTCALC], [Time].[Fisca].[Year].Members); 
    THIS = 2; 
END SCOPE; 

SCOPE([Measures].[TESTCALC], [Time].[Fiscal].[All]); 
    THIS = 3; 
END SCOPE;

SELECT 
{[Measures].[TESTCALC]} ON COLUMNS,
{[Time].[Fiscal].[All]
,[Time].[Fiscal].[Year].[FY2010]
,[Time].[Fiscal].[Period].[FY2010-APR]} ON ROWS
FROM [Test Cube]

As expected, results in:
All	3
FY2010	2
FY2010-APR	1


Each of these queries also create results with values from the scope statements:

SELECT {[Measures].[TESTCALC]} ON COLUMNS FROM [Test Cube] WHERE {[Time].[Fiscal].[All]}
Result: 3

SELECT {[Measures].[TESTCALC]} ON COLUMNS FROM [Test Cube] WHERE {[Time].[Fiscal].[Year].[FY2010]}
Result: 2

SELECT {[Measures].[TESTCALC]} ON COLUMNS FROM [Test Cube] WHERE {[Time].[Fiscal].[Period].[FY2010-APR]}
Result: 1


Using a multi-member WHERE clause causes the unscoped value to appears:

SELECT {[Measures].[TESTCALC]} ON COLUMNS FROM [Test Cube]
WHERE  {[Time].Fiscal].[Year].[FY2010], [Time].[Fiscal].[Year].[FY2011]}
Result: 1

Using Excel 2007, I get a different answer.  Looking at Excel&#039;s MDX, I see a subquery.  This query returns the “all” scope value of 3.
SELECT  FROM 
(SELECT 
	({[Time].[Fiscal].[Year].&amp;[2010],[Time].[Fiscal].[Year].&amp;[2011]}) ON COLUMNS  
	FROM [Test Cube]) WHERE ([Measures].[TESTCALC])
Result: 3]]></description>
		<content:encoded><![CDATA[<p>Chris,</p>
<p>I recreated your experiment and I see similar results but with a couple of exceptions noted below.  I &#8216;d like to know the rules that are in effect here if anyone can offer an explanation. We are struggling with a couple of our scoped measures and this might help explain the results we are seeing.<br />
Thanks,<br />
Paul</p>
<p>CREATE MEMBER CURRENTCUBE.[Measures].[TESTCALC] AS 1; </p>
<p>SCOPE([Measures].[TESTCALC], [Time].[Fisca].[Year].Members);<br />
    THIS = 2;<br />
END SCOPE; </p>
<p>SCOPE([Measures].[TESTCALC], [Time].[Fiscal].[All]);<br />
    THIS = 3;<br />
END SCOPE;</p>
<p>SELECT<br />
{[Measures].[TESTCALC]} ON COLUMNS,<br />
{[Time].[Fiscal].[All]<br />
,[Time].[Fiscal].[Year].[FY2010]<br />
,[Time].[Fiscal].[Period].[FY2010-APR]} ON ROWS<br />
FROM [Test Cube]</p>
<p>As expected, results in:<br />
All	3<br />
FY2010	2<br />
FY2010-APR	1</p>
<p>Each of these queries also create results with values from the scope statements:</p>
<p>SELECT {[Measures].[TESTCALC]} ON COLUMNS FROM [Test Cube] WHERE {[Time].[Fiscal].[All]}<br />
Result: 3</p>
<p>SELECT {[Measures].[TESTCALC]} ON COLUMNS FROM [Test Cube] WHERE {[Time].[Fiscal].[Year].[FY2010]}<br />
Result: 2</p>
<p>SELECT {[Measures].[TESTCALC]} ON COLUMNS FROM [Test Cube] WHERE {[Time].[Fiscal].[Period].[FY2010-APR]}<br />
Result: 1</p>
<p>Using a multi-member WHERE clause causes the unscoped value to appears:</p>
<p>SELECT {[Measures].[TESTCALC]} ON COLUMNS FROM [Test Cube]<br />
WHERE  {[Time].Fiscal].[Year].[FY2010], [Time].[Fiscal].[Year].[FY2011]}<br />
Result: 1</p>
<p>Using Excel 2007, I get a different answer.  Looking at Excel&#8217;s MDX, I see a subquery.  This query returns the “all” scope value of 3.<br />
SELECT  FROM<br />
(SELECT<br />
	({[Time].[Fiscal].[Year].&amp;[2010],[Time].[Fiscal].[Year].&amp;[2011]}) ON COLUMNS<br />
	FROM [Test Cube]) WHERE ([Measures].[TESTCALC])<br />
Result: 3</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Saurav Mishra</title>
		<link>http://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-2620</link>
		<dc:creator><![CDATA[Saurav Mishra]]></dc:creator>
		<pubDate>Fri, 28 Oct 2011 11:13:53 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-2620</guid>
		<description><![CDATA[I too would like to understand why its the intended behaviour.
-Saurav]]></description>
		<content:encoded><![CDATA[<p>I too would like to understand why its the intended behaviour.<br />
-Saurav</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrej Kuklin</title>
		<link>http://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-2619</link>
		<dc:creator><![CDATA[Andrej Kuklin]]></dc:creator>
		<pubDate>Fri, 28 Oct 2011 10:03:08 +0000</pubDate>
		<guid isPermaLink="false">https://cwebbbi.wordpress.com/2011/10/27/scoped-assignments-and-multiselect/#comment-2619</guid>
		<description><![CDATA[I&#039;ve just tested it and of course
SELECT [Measures].[TESTCALC] ON 0,
[Date].[Calendar Year].Members on 1
FROM [Adventure Works]

returns the expected result (3 for [All Periods] and 2 for individual years). I would really like to know how the &quot;specific rule&quot; is defined and why this can be &quot;intended behaviour&quot;]]></description>
		<content:encoded><![CDATA[<p>I&#8217;ve just tested it and of course<br />
SELECT [Measures].[TESTCALC] ON 0,<br />
[Date].[Calendar Year].Members on 1<br />
FROM [Adventure Works]</p>
<p>returns the expected result (3 for [All Periods] and 2 for individual years). I would really like to know how the &#8220;specific rule&#8221; is defined and why this can be &#8220;intended behaviour&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
