I have a Customer dimension modeled as a Type 2 SCD. The only attribute that will change over time is a bit field that stores the "Is Married" status.
So lets say I have a Customer named John Smith who was not married before 2012-01-01 and was married on 2012-01-01 and after. This would have 2 rows in my Customer dimension with 2 different Surrogate Keys (e.g. S1 and S2) but both rows would have the
same Business Key (e.g. B1). So far so good and nothing out of the ordinary to my knowledge.
Now lets say I have a fact table named Sales.. any sales for this customer before 2012-01-01 would be linked to the S1 row (non married)and any sales on 2012-01-01 and after would link to the S2 row (married).
My question is this:
Using a very basic browser like the one that comes with SQL management studio even, how can I let the user to only look at sales that occured while the Customer was married. So in my example, only the Sales records that are linked to the S2 record. This
seems very basic to me and I cannot seem to find an answer.
So assuming the following:
[Customer].[Customer] = Business Key
[Customer].[Customer SCD] = Surrogate Key
I tried 2 different named sets to see if that would work for me...
The following named set will include any customers who have EVER been married.. not just the ones married at the time
of the sale:
EXISTS
(
[Customer].[Customer].Children,
FILTER(
[Customer].[Customer
SCD].MEMBERS,
CBool(
IIF(
[Customer].[Customer
SCD].CurrentMember.Properties("Is Married") = "True",
1,
0
)
)
= True
)
)
Whereas the following does exactly what I want.. but will not show up unless I make the Customer SCD attribute hiearchy visible.. which I read you are not supposed to do because that would expose the surrogate key to the client tool:
FILTER(
[Customer].[Customer
SCD].MEMBERS,
CBool(
IIF(
[Customer].[Customer
SCD].CurrentMember.Properties("Is Married") = "True",
1,
0
)
)
= True
)
The solution does not have to use a named set.. I just want the user to be able to do it themselves. Does anyone have some wisdom to dispense to this poor lost soul?