Quantcast
Channel: SQLServerCentral » Data Warehousing » Analysis Services » Latest topics
Viewing all articles
Browse latest Browse all 1341

Calculations across fact tables related by dimensions

$
0
0
This seems like a pretty basic question, which probably will tell you about my level of expertise with SSAS, but I haven't been able to find a good answer otherwise, perhaps because I don't know how to phrase the question more simply!I'm trying to build a cube that will allow users to analyse sales that have not been paid in full.I have 2 fact tables (and dimensions date, customer and supplier):fact-Sales----------CustomerID (fk)SupplierID (fk)SaleDate (fk)SaleAmountfact-Payments-------------CustomerID (fk)SupplierID (fk)PaymentDate (fk)PaymentAmountIn my (tabular) cube, I'm needing to have a "balance" measure that is something to the effect of:Balance := fact-Sales[SalesAmount] - SUM(RELATED(fact-Payments[PaymentAmount]))Which doesn't seem to work, I suspect since the relationship is through the dimensions, not directly from fact table to fact table.I also tried to create a calculated column [Total Payments]:= SUM(RELATED(fact-Payments[PaymentAmount])), which also fails.So am I modeling this correctly? Should I explicitly define relationships between the fact tables, event though they have different levels of granularity? Perhaps I could simply increase the granularity of the sales table by adding the payment info so I have a single fact table, or should I use a bridge table? Should I just create an SQL view on sales with the aggregated column from the payments table?I'm obviously just getting started with this, and I'm wanting to "do it right", so anything can be changed at this point.

Viewing all articles
Browse latest Browse all 1341

Trending Articles