SQLServerCentral.com / SQL Server 2008 - General / SQL Server 2008 / How do I calculate totals for a distributed measure in SSAS? / Latest PostsInstantForum.NET v2.9.0SQLServerCentral.comhttp://www.sqlservercentral.com/Forums/notifications@sqlservercentral.comThu, 28 Aug 2014 03:32:52 GMT20How do I calculate totals for a distributed measure in SSAS?http://www.sqlservercentral.com/Forums/Topic1444244-391-1.aspxI'm not sure if this is the right place to post my question but here goes.I have an OLAP cube consisting of quite a few tables.In this scenario there's only reason to look at one fact table with costs.This table constructed by a join in SQL with a table of distribution keys.The purpose is to split costs across Company, Cost Center, etc.The joining keys are Company, CostCenter, AccountGroup, DateFrom, and DateTo.As such, the number of rows can be blown up a multitude of times.If we look at a simple case with just one variable: Cost Distribution Distributed Cost Count DistrCalcCompany A 100 0.8 80 1 0.8Company B 200 0.2 40 1 0.2Total 300 1.0 120 2 0.5I need to show the Distribution figure in the cube.I do that by dividing Distribution with Count as you can see in the final column in the table above, DistrCalc.Here's the cube formulaIif( [Measures].[Count] = 0 Or [Measures].[] is NULL , NULL , [Measures].[Distribution] / [Measures].[Count])The Total of 0.5 for DistrCalc is clearly wrong. I should be 1.0 (or if not possible, NULL).Since we use Excel as the frontend tool we could easily switch off totals but totals are relevant for other measures.So how do I get around this problem?I'm thinking that some sort of Scope statement could it. But it has to span across all the variables from the SQL join.My level of expertise in MDX is unfortunately not very high, and Google hasn't provided me with a usable result.Thank you in advance!Hans RiisFri, 19 Apr 2013 01:07:21 GMTHans Riis