Question

I have cost center allocation data that is currently fully populated, one record per day, each with one cost center dimension key. The cube has a head count measure (the data is set to "1"), and the aggregate function is set to "LastChild". This means that a head count report will count a person only once in a cost center in any given time period.

Introducing partial allocations - a new measure will have a percentage value for the allocation, allowing for multiple concurrent cost centers where the allocation should add up to 100% (with "day" being the granular level). I am trying to figure out how to configure the aggregation over other time periods. I thought that "Average" should work just fine, i.e. a person who is allocated to a cost center at 50% for half the time period will be reported at 25% for that period. The problem that I see is that my facts are not populated for days where the allocation to a cost center was 0%. To illustrate:

Employee1 CostCenterA 1/1/2013 50%
Employee1 CostCenterB 1/1/2013 50%
Employee1 CostCenterA 1/2/2013 100%
Employee1 CostCenterA 1/3/2013 100%
... etc with 100% in CostCenterA for all days 

The above data on a report by month shows 50% for the allocation to CostCenterB, even though the person was only allocated for one day, and the average percentage on a monthly basis should be 1.6%.

I suppose I could generate the 0%-allocations in the data, but my fact table would explode as a result, so I'd much rather change how the "average" aggregation treats percentage values in facts that are sparsely populated, i.e. the average should be calculated based on the number of granular units in the reporting period (days in the month, in this case 0.5/31), not the number of rows in the fact table (0.5/1). Can this be done in SSAS?

Was it helpful?

Solution

If the measure with the average allocation is off by a factor that is proportional to the "sparseness" of my facts, i.e. the ratio of days in a period and actual fact rows, then it can be corrected as follows:

adjusted average allocation = 
  (calculated average allocation) * (fact count)/(number of days in period)

I created two new hidden measures, one named [Fact Count] for the fact count (a measure using the AggregateFunction "Count") and a calculated measure named [Days In Period Count] for the number of days, using the expression

COUNT(Descendants([Date].[Calendar].CurrentMember,5),INCLUDEEMPTY)

with [Calendar] being the name of the hierarchy in my Date dimension.

Finally, I added a calculated measure that implements the corrective formula:

[Measures].[Allocative Head Count]/
(
    [Measures].[Days In Period Count]/[Measures].[Fact Count]
)

and named it [Adjusted Average Allocation]. This I can now use in reports and it appears to somewhat approximate the average cost center allocation over longer periods.

The formular for [Days In Period Count] btw does not work for the row totals when filters are involved. I opened another question for this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top