Saturday, February 25, 2012

Null Processing and RowCounts

Problem: Although my query against three relational fact tables correctly returns the basic truth that "RowCount All_Transaction table" = "RowCount Loan table" + "RowCount Sale table", my cube-browser query rowcounts in these tables' resulting cube shows (incorrectly) that "RowCount All_Transaction table" = "RowCount Loan Table" ...and I'm scratchin' my head about why! Note: I'm on SSAS2005 SP2, Dev Edition

Background:

DSV -- Fact Tables:

(1.) All_Transaction: Contains generic facts (dates, asset info, etc.) on two types of asset transactions (sales and loans). In DSV, it is is directly related to each of the next two fact tables.

(2) Loan: Contains loan-specific facts (loan amt, etc.) for loan transactions. Does not directly connect to Sale fact table.

(3) Sale: Contains sale-specific facts (sale price, etc.) for sale transactions. Does not directly connect to Loan fact table.

Additionally, DSV table relationships from all_transaction to other two has all_transaction as "Destination / PK" and other table as "Source / FK" table, which is in keeping with relational rule that all FK's must relate to one PK. Lastly, with regard to relational and DSV fact tables, cardinality is actually one-to-one, since each row in LOAN (or SALE) table relates to exactly one row in All_Transaction.

Cube Measure Groups:

Of course, all three fact tables are measure groups. ALL_Transaction and LOAN fact tables are also reference dimensions, with dimension cardinality to each other's measure group set as "One". This was done to allow slice-n-dice by dimensions, all of which are connected to just those two measure groups.

Anybody have ideas on why this is occurring, and what to do about it?

Note: My relational SQL-Dev coworker suggests it sounds like a "left-join vs. inner join vs. right join" issue and/or an issue of which measure group is the "main" measure group", but I don't know that these ideas apply to SSAS.

Your thoughts?

I'm going to close the loop by answering my own question...

Reason for Problem:

The reason is that, (1) I was using the "ALL_Transaction" fact table also as an intermediate dimension for "ALL_Transaction" - related dimensions indirectly referencing "LOAN" fact table, and (2) I had selected "unknown member" for null properties on the dimension key for "ALL_Transaction" intermediate dimension. As a result, the COUNT aggregation, by design, ignored all of the so-called "unknown member" ALL_Transaction PK's that don't have a corresponding LOAN table FK (by design, many don't).

Solution: On "ALL_Transaction" dimension key field, change "KeyColumn / Null Processing" property from "Unknown Member" to "Preserve". Simple (now that I found the solution).

No comments:

Post a Comment