Question

So I have a dimensional database for shipments:

A shipment contains many packages. A package contains many charges.

Because this is dimensional and the charges are the data I'm most interested in, I've flattened the 3 tables and their many to one relationships into a single charges fact table. Here's a quick snapshot of a single shipment that contains two packages each weighing 1 lb.

enter image description here

In order to make package weight queryable I've needed to push it down to the charge grain. This causes problems with aggregation. A package weight of 1 lb applies to each package, and should result in 2 lbs for the shipment. I can't find a way to aggregate the weight as a measure in this fashion. I'm very new to SSAS and OLAP and don't really know what next to try. Any suggestions would be greatly appreciated.

Was it helpful?

Solution

The problem is the way you have the data modeled. The lowest level of granularity of your (fact) table is "charge amount"..."package weight" amount is at a higher level of granularity (the Package Level).

You have two options...

  1. In your ETL, you can allocate the 1 lbs across the different charge amounts for each package (see screenshot below). That way when you slice this fact table by Shipment or Package, you will see 2lbs or 1lbs, respectively.

    screenshot

  2. Pull the "package weight" field out of this fact table and put it in one where the granularity is at the package level.

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