Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

How do I calculate totals for a distributed measure in SSAS? Expand / Collapse
Posted Friday, April 19, 2013 1:07 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, May 12, 2013 7:33 AM
Points: 1, Visits: 29
I'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 DistrCalc
Company A 100 0.8 80 1 0.8
Company B 200 0.2 40 1 0.2
Total 300 1.0 120 2 0.5

I 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 formula
Iif( [Measures].[Count] = 0 Or [Measures].[] is 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 Riis
Post #1444244
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse