<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://denglishbi.spaces.live.com/mmm2008-05-17_13.22/rsspretty.aspx?rssquery=en-US;http%3a%2f%2fdenglishbi.spaces.live.com%2fcategory%2fAnalysis%2bServices%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Dan English's BI Blog: Analysis Services</title><description /><link>http://denglishbi.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&amp;_c=BlogPart&amp;partqs=catAnalysis%2bServices</link><language>en-US</language><pubDate>Sun, 20 Jul 2008 13:37:12 GMT</pubDate><lastBuildDate>Sun, 20 Jul 2008 13:37:12 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><cf:parentRSS>http://denglishbi.spaces.live.com/blog/feed.rss</cf:parentRSS><live:type>blogcategory</live:type><live:identity><live:id>-3657354010876223112</live:id><live:alias>denglishbi</live:alias></live:identity><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>SSAS Deployment Wizard Retaining Permissions</title><link>http://denglishbi.spaces.live.com/Blog/cns!CD3E77E793DF6178!490.entry</link><description>&lt;p&gt;Had a great question last week at the MNPASS SQL Server User Group in regards to using the Analysis Services Deployment Wizard and I just wanted to post the follow-up.  I have read about the wizard, but actually have never used it (but you need to know about it for the MCTS test 70-445 or 70-448).  I have just always deployed my databases through BIDS and have always had the roles and permissions defined in the solution.  This provided me a great opportunity to explore the wizard.  What I needed to find out was if the issue of losing the database permissions had been fixed in 2008 (refer to this MS KB article for the current issue &lt;a href="http://support.microsoft.com/kb/933836" target="_blank"&gt;here&lt;/a&gt; – basically the permissions do not get pulled into the XMLA script using the ‘Retain roles and members. The roles and members will not be deployed.’ option). &lt;p&gt;&lt;a href="http://blufiles.storage.msn.com/y1plj8BsZ5jWVxyRvAPDJReG40pBjwwNMcuFde9A22cutXfufghHenNGZgpU_gGpeEM?PARTNER=WRITER" target="_blank"&gt;&lt;img title="ssas_dw_options" style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=206 alt="ssas_dw_options" src="http://blufiles.storage.msn.com/y1pohwNhgx2rstBQoIaZUFbfczWwboyxwCSeNjE48AOFGYU7XBjxwTjesv52ini2Ddy?PARTNER=WRITER" width=244 border=0&gt;&lt;/a&gt;  &lt;p&gt;So first I tested this out in 2005 to verify that this was an issue and there wasn’t a hidden checkbox somewhere to resolve the issue.  I generated the script and reviewed it and it did pull in the roles and members, but no permissions (database, dimensions, etc.).  So whatever permissions were setup on the server would be wiped out once the script was executed.  Here is a snippet of the script and if you performed a search in the file you would see that no permissions were included. &lt;p&gt;&lt;a href="http://blufiles.storage.msn.com/y1pWoxL4-jecXWjTcJ__n8bkvyM3DtIYXs_AgsF8DHFSCk2lLjcbdvVqbr1fMbW-Emy?PARTNER=WRITER" target="_blank"&gt;&lt;img title="ssas2005_dw_script" style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=107 alt="ssas2005_dw_script" src="http://blufiles.storage.msn.com/y1psIvAcdKY_w84fvFW3bAw-IYtWx8q0YTnTBRIgjIXS7CgBJqrTEh8KvH8Y9uZ3B-v?PARTNER=WRITER" width=244 border=0&gt;&lt;/a&gt;  &lt;p&gt;I then setup a project in BIDS 2008 (VS 2008) and performed the same steps as with 2005 and everything was pulled into the script properly (cube, database, and dimension permissions) this time&lt;img alt=Open-mouthed src="http://messenger.msn.com/MMM2006-04-19_17.00/Resource/emoticons/teeth_smile.gif"&gt; &lt;p&gt;&lt;a href="http://vas9rg.blu.livefilestore.com/y1pbY8IrqXygiJYX2DSmY84ZXUlJaRs46nwlWd4dhly2EpHIsXUWDMKNrVijrxUHUXXCTRF5Wtkk0A?PARTNER=WRITER" target="_blank"&gt;&lt;img title="ssas2008_dw_script1" style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=159 alt="ssas2008_dw_script1" src="http://blufiles.storage.msn.com/y1pp2VcULISCMSaQgGewrd3J7FJA1Xr9VC1OffbyIKsOBSng7_fik_qeyh2k-KH75fVaoJVdSaWP7M?PARTNER=WRITER" width=244 border=0&gt;&lt;/a&gt; &lt;a href="http://blufiles.storage.msn.com/y1pwZa2ETM7IyiULH4oiMkCjt_4ReMAiguWXlpj5BSez3jLRNNGHiHxlQRFpuPP5fEHqlKK8IAgB-Y?PARTNER=WRITER" target="_blank"&gt;&lt;img title="ssas2008_dw_script2" style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=105 alt="ssas2008_dw_script2" src="http://blufiles.storage.msn.com/y1pBiDXdT6lLhL6GqVkTkTsRugspZe0j8kNlkrZfDVCCaWIZhjnNmgqKWF9q5InRMzLGvK4yEUI0Gk?PARTNER=WRITER" width=244 border=0&gt;&lt;/a&gt;  &lt;p&gt;The one thing is though if you are trying to separate the security control and permissions from the developers and DBAs this really won’t fix that problem because the wizard needs to extract the permissions and include them in the file to be executed against the SSAS database.  This means that the developers will be able to view and modify the permissions prior to executing the script.  I suppose this would mean that the DBAs would need to take over the responsibilities of using the deployment wizard or at least have a backup script of the existing Roles setup on the server prior to deployment.&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-3657354010876223112&amp;page=RSS%3a+SSAS+Deployment+Wizard+Retaining+Permissions&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=denglishbi.spaces.live.com&amp;amp;GT1=denglishbi"&gt;</description><comments>http://denglishbi.spaces.live.com/Blog/cns!CD3E77E793DF6178!490.entry#comment</comments><guid isPermaLink="true">http://denglishbi.spaces.live.com/Blog/cns!CD3E77E793DF6178!490.entry</guid><pubDate>Sun, 20 Jul 2008 13:37:12 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://denglishbi.spaces.live.com/blog/cns!CD3E77E793DF6178!490/comments/feed.rss</wfw:commentRss><wfw:comment>http://denglishbi.spaces.live.com/Blog/cns!CD3E77E793DF6178!490.entry#comment</wfw:comment><dcterms:modified>2008-07-20T13:37:12Z</dcterms:modified></item><item><title>SSAS MDX Round = Banker's Rounding</title><link>http://denglishbi.spaces.live.com/Blog/cns!CD3E77E793DF6178!362.entry</link><description>&lt;p&gt;A couple of weeks ago I was working on a project where I had to implement some Ranking calculations within an Analysis Service (SSAS) cube.  I went ahead and added in the calculations and then the client came back to me and stated that there was some additional business logic that we needed to implement.  At different levels of reporting they utilize some rounding into the calculation that is used to determine the Ranking.  When viewing the report at a store level then we need to round the calculation to two decimal places and at all other levels the value will be rounded to four decimal places to be used in the Ranking function.  I thought to myself 'no problem' and I went ahead and added in this additional logic and put the Round function into place to handle this logic.  Done. &lt;p&gt;Well was I wrong.  The client came back to me and said that stores were not being ranked properly and why if these had the same calculation score, 93%, did they not have the same rank.  I was like 'what?  all i did was add the business logic you requested'.  So I went ahead and started digging into the issue and this opened up a whole can of worms that took me a couple of days to sort out and it was a nightmare -- rounding is just plain bad.  What we were seeing on the report was a score of 93% and two scores would have values of say 92.75% and 92.50%.  Now back from my school days using the basic arithmetic round that we all used we would say that these should both be rounded up to 93%, well that 'depends'.  It turns out that there are quite a few methods of rounding and unfortunately the Microsoft products all differ in how they use the round function and I found a good article explaining that &lt;a href="http://support.microsoft.com/default.aspx/kb/196652" target="_blank"&gt;here&lt;/a&gt;.  It turns out that in this case Banker's Rounding was implemented where if the value is at say .5 it will simply round to the nearest even number.  And sure enough this is what was happening; here are some examples that show this (replace cube name with a valid cube name): &lt;blockquote&gt; &lt;p&gt;&lt;em&gt;--this does not round 92.5 up to 93 as expected&lt;/em&gt;  &lt;p&gt;&lt;em&gt;with member measures.test1 as round(.923,2)&lt;/em&gt;  &lt;p&gt;&lt;em&gt;     member measures.test2 as round(.925,2)&lt;/em&gt;  &lt;p&gt;&lt;em&gt;     member measures.test3 as round(.927,2)&lt;/em&gt;  &lt;p&gt;&lt;em&gt;select {measures.test1, measures.test2, measures.test3} on columns&lt;/em&gt;  &lt;p&gt;&lt;em&gt;from [cube name]&lt;/em&gt;&lt;/blockquote&gt; &lt;p&gt;This was not what we wanted, so now I was on a quest to resolve this.  I thought I could just try and utilize the vbamdx.round call, but that returned the same thing.  I went ahead and tried using the system.math.round call in .NET code to see what that returned to see if I could possibly just implement an SSAS stored procedure (functions are what I call them), but same thing.  I opened up my trusty Excel and tried the round function in there and it worked the way I expected it to.  I was like it is about time...so I thought I would simple use the excelmdx.round in my calculation, but it turns out you actually need to install Excel on the server (found reference to this in the MSDN forums &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1946656&amp;amp;SiteID=1" target="_blank"&gt;here&lt;/a&gt;) for this to work and it will fire up an instance of the excel object when you use this.  So this was not a solution either since we were not going to do that.  I found another solution in the MSDN forums &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1603622&amp;amp;SiteID=1" target="_blank"&gt;here&lt;/a&gt; that stated that you could just use the following logic -int(-(VALUE*100)) and sure it works for my .9250 value, but this logic is basically just returning the CEILING and this is not what I wanted for all of my values (like .9210 would display as 93 -- not what we wanted).  What I ended up doing was implementing some crazy CASE logic that evaluated the value to determine if the last numeric value on the right was a 5 then use the CEILING function that I just listed, otherwise just go with the regular round function. &lt;p&gt;So now I was done, right?  Wrong.  Now we were still getting a few stores that were still not lining up where the report would show 93%, but what was being used by the Ranking was still 92%, so now what was the problem.  It turns out the calculation was returning .9250, but it was actually .92499999, so why was the calculation returning .9250?  I didn't have any type of formatting in the calculation, this was just a straight calculation returning the underlying value.  This was driving me completely insane.  How did I go about resolving this additional rounding issue, good question.  I ended up doing the following: int(value*100000)/100000 and using this value instead of just value. &lt;p&gt;So now I was done, right? Wrong again.  Now we were still seeing some incorrect values.  This is what we ended up seeing and shows the different values returned by int and cint. &lt;blockquote&gt; &lt;p&gt;      &lt;em&gt;value = .57549&lt;/em&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;em&gt;                Incorrect calc: int(round(value),2)*100) = 57&lt;/em&gt;  &lt;p&gt;&lt;em&gt;                Fixed calc: cint(round(value),2)*100) = 58&lt;/em&gt;  &lt;p&gt;I went ahead and changed my references of int to cint and finally I had victory!  I was actually done solving this crazy rounding issue.  It wouldn't have been that bad if we were just rounding and displaying values; this could have basically been handled by using some formatting in the calculation, but when you need to actually use the result in a Ranking function it is a completely different story.  I am really hoping that there was an easier solution for this, but being under the gun and needing this implemented by the deadline this is what I came up with.  I was able to finally get a good night sleep.&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-3657354010876223112&amp;page=RSS%3a+SSAS+MDX+Round+%3d+Banker's+Rounding&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=denglishbi.spaces.live.com&amp;amp;GT1=denglishbi"&gt;</description><comments>http://denglishbi.spaces.live.com/Blog/cns!CD3E77E793DF6178!362.entry#comment</comments><guid isPermaLink="true">http://denglishbi.spaces.live.com/Blog/cns!CD3E77E793DF6178!362.entry</guid><pubDate>Sat, 19 Apr 2008 13:10:09 GMT</pubDate><slash:comments>5</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://denglishbi.spaces.live.com/blog/cns!CD3E77E793DF6178!362/comments/feed.rss</wfw:commentRss><wfw:comment>http://denglishbi.spaces.live.com/Blog/cns!CD3E77E793DF6178!362.entry#comment</wfw:comment><dcterms:modified>2008-04-21T12:03:52Z</dcterms:modified></item><item><title>SSAS returning wrong results (cache related)</title><link>http://denglishbi.spaces.live.com/Blog/cns!CD3E77E793DF6178!229.entry</link><description>&lt;p&gt;Ran into a rather odd issue today.  End-user reported that the chart being displayed to them was returning the wrong results and different filters were returning the same results.  Here is the example of two queries that I used to validate the results and I was able to reproduce the issue: &lt;p&gt;&lt;font color="#0000ff" size=2&gt;SELECT NON EMPTY { { [Date].[Quarter Year].&amp;amp;[2007]&amp;amp;[3], [Date].[Quarter Year].&amp;amp;[2007]&amp;amp;[4], [Date].[Quarter Year].&amp;amp;[2008]&amp;amp;[1] } } ON COLUMNS, &lt;/font&gt; &lt;p&gt;&lt;font color="#0000ff" size=2&gt;NON EMPTY { Crossjoin({ [Brand].[Brand Label].[Brand1]}, { [Measures].[TBA], [Measures].[TBA(Base)] } ) } ON ROWS&lt;/font&gt;  &lt;p&gt;&lt;font color="#0000ff" size=2&gt;FROM [cube] WHERE ( ( [Market].[Market].[USS] ), { [State].[State].&amp;amp;[Georgia], [State].[State].&amp;amp;[Florida], [State].[State].&amp;amp;[South Carolina] } )&lt;/font&gt;  &lt;p&gt;&lt;font size=2&gt;AND&lt;/font&gt;  &lt;p&gt;&lt;font color="#0000ff" size=2&gt;select {[Measures].[TBA], [Measures].[TBA(Base)]} on columns,&lt;/font&gt;  &lt;p&gt;&lt;font color="#0000ff" size=2&gt;non empty([Brand].[Brand Label].[Brand1]) on rows&lt;/font&gt;  &lt;p&gt;&lt;font color="#0000ff" size=2&gt;from cube where ([Market].[Market].&amp;amp;[USS], [Date].[Quarter Year].&amp;amp;[2007]&amp;amp;[3])&lt;/font&gt;  &lt;p&gt;If I ran these queries in this order the results for 2007 Q3 were 56% and 1082.  This was correct for the first one based on the WHERE clause, but not for the second MDX statement.  I was really puzzled, but I decided to clear the cache and try again.  This time I ran the queries in reverse order and I got the correct values (second query was 49.6% and 3312.  I found a posting about setting the Cache Policy in the connection string to 9 or setting this at the server level in the msmdsrv.ini file (setting CalculationCoverPolicy to 9 instead of 0 which is the default).  When I did this modification and restarted SSAS everything worked properly no matter which order I ran the MDX statements in.  Really odd behavior still since both queries have different filters for the WHERE clause.  Luckily I saw the Cache Policy setting in Mosha's &lt;a href="http://www.sqljunkies.com/WebLog/mosha/archive/2007/01/28/iif_performance.aspx" target="_blank"&gt;posting&lt;/a&gt;  and Chris Webb also had a similar &lt;a href="http://cwebbbi.spaces.live.com/blog/cns!7B84B0F2C239489A!1506.entry" target="_blank"&gt;posting&lt;/a&gt; about this type of issue.  There was also a &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1525069&amp;amp;SiteID=1" target="_blank"&gt;posting&lt;/a&gt; in the Microsoft Forums that I used for reference.  &lt;p&gt;I tested this in SQL 2008 Nov CTP5 and similar results.  When I ran them in this order the second query actually returned 151.9% instead of 56% even though the correct result was supposed to be 49.6%.  The second value was the same in SQL 2005.  The same fix to the msmdsrv.ini file fixes the issue though.  I will have to make a call ticket with MS Support and make them aware of this bug.  I will let you know if they tell me to make a different fix to resolve this issue. &lt;p&gt;&lt;strong&gt;UPDATE (12/19/2007):&lt;/strong&gt;  &lt;p&gt;Just wanted to provide an update in regards to this issue with the cache reuse in Analysis Services.  I did test both these MDX statements in Mosha's &lt;a href="http://cid-74f04d1ea28ece4e.skydrive.live.com/browse.aspx/MDXStudio" target="_blank"&gt;MDX Studio&lt;/a&gt; and when the 2nd statement is executed it will only return the results from the cache and it will not perform any calculations.  If you clear the cache and run them in the reverse order then it will perform the necessary calculations and everything is fine.  Making the 'Cache Policy' setting change does resolve the issue and you can run the statements in either order.  &lt;p&gt;MS Support got back to me and they did state that there is an issue with the cache reuse with the current product (and actually the next version of the product) and they have filed the issue with the development team.  The interesting thing is that another way that they reported that this can be resolved was swapping out the function being used in one of the calculations.  The current calculation is using the Aggregate function and they switched it to the Sum function and this fixed the problem also.  Really odd since these are basically setup to do the same thing.  They stated that it can be problematic using the Aggregate function to aggregate a calculated member.  &lt;p&gt;In regards to the Cache Policy setting here is what they had to say:  &lt;p&gt;&lt;em&gt;&lt;font color="#008000"&gt;The cache policy setting (9 instead of 0) you were using as a workaround is intended to change how the formula engine answers queries; it will cause the formula engine to lean towards using block evaluation mode more, instead of cell-by-cell mode. Generally, this can result in faster queries, but it can also slow down some queries, so there is a risk involved with it. Microsoft CSS does not usually recommend this setting as a general approach/resolution.&lt;/font&gt;&lt;/em&gt;  &lt;p&gt;&lt;em&gt;&lt;font color="#008000"&gt;&lt;/font&gt;&lt;/em&gt; &lt;p&gt;&lt;em&gt;&lt;font color="#008000"&gt;It’s usually a better idea to find ways to improve the queries without using cache policy; it should only be used as a last resort, and only under the direction of CSS. We generally do not make the details of the cache policy settings public, because they do carry risks, and they are intended only for special cases that should be determined by customer support.&lt;/font&gt;&lt;/em&gt;  &lt;p&gt;&lt;em&gt;&lt;/em&gt; &lt;p&gt;Makes sense, but how would I have ever come to the conclusion that the issue was actually with the function we were using to perform the calculation?  Extremely odd behavior if you ask me and this is pretty scary.  Hopefully they will come up with a solution to resolve the incorrect cache reuse.  How do I know that this is the only scenario that is going to return incorrect results? &lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-3657354010876223112&amp;page=RSS%3a+SSAS+returning+wrong+results+(cache+related)&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=denglishbi.spaces.live.com&amp;amp;GT1=denglishbi"&gt;</description><comments>http://denglishbi.spaces.live.com/Blog/cns!CD3E77E793DF6178!229.entry#comment</comments><guid isPermaLink="true">http://denglishbi.spaces.live.com/Blog/cns!CD3E77E793DF6178!229.entry</guid><pubDate>Wed, 12 Dec 2007 01:30:51 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://denglishbi.spaces.live.com/blog/cns!CD3E77E793DF6178!229/comments/feed.rss</wfw:commentRss><wfw:comment>http://denglishbi.spaces.live.com/Blog/cns!CD3E77E793DF6178!229.entry#comment</wfw:comment><dcterms:modified>2008-03-24T19:51:48Z</dcterms:modified></item></channel></rss>