Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

Issue with Advanced Aggregation in Pivot - Weighted Average Headcount Totals

Question
2
Views
0
Comments
Tim Ouimet
Tim Ouimet Rank 4 - Community Specialist

The issue I'm having relates to calculating weighted daily average headcount - totalling by Qtr, Year, by Site.

The Data is stored at the Contract Grain, Monthly.

The Hierarchy looks like Site -> Customer -> Contract., Time is by Year -> Qtr -> Month.

Using our Business Model we're trying to build Weighted Hc - by month, totalled at Quarter, Year.

Should look like this:

Correct Data

SiteJanFebMarQTR
Location 1272265262266.4
Contract 1180169168172.4
Contract 292969494
Location 2184181167177.3
Contract 395917988.3
Contract 444444343.7
Contract 545464545.3
Total Locations456446429443.6
Days in Month31293191

Total Days in Month is set as a SUM across the Calendar Dimension, and a MAX across the Company Dimension (Location, Contract etc..).

What is happening with my weighted totals - is that the Total Location is displaying the MAX at the Location Grain, but the Correct total at the Total Locations Line!

Incorrect Data

SiteJanFebMarQTR
Location 1272265262266.4
Contract 1180169168172.4
Contract 292969494
Location 2272265262266.4
Contract 395917988.3
Contract 444444343.7
Contract 545464545.3
Total Locations456446429443.6
Days in Month31293191

The logic at the base table assumes that every day an employee is active, registers a 1 in the source table, so an employee would have 91 records in the detailed table for Q1'16.

The Summary Table has all the employee records summarized to 3 rows, one per month, joining to Calendar Month table grain.  Each record has 31, 29, 31 as the headcount respectively.

The source data is weighted - so that it does Num of Days * Headcount / number of Days.

sum(Fact COA Goals Monthly.PROJECTED_HEADCOUNT * Fact COA Goals Monthly.NUM_OF_DAYS) / nullif( max(sum(Fact COA Goals Monthly.NUM_OF_DAYS)) * 1 , 0)

Any ideas how to control the Site Totals grain weighted abilities with Aggregation Tab on a Logical Column?

Thanks,

Tim Ouimet