Forum Discussion
Switching relationships between tables but USERELATIONSHIP has limitations (data modeling problem)
Question: is there any other "tool" than USERELATIONSHIP that we could use to allow switching from the Active to the Inactive relationships in the data model?
The problem: my team is responsible for creating golden datasets. One of the common features is to allow users to report either with current dimension or with historical dimension data. For example: 10 years sales by portfolio manager could be looked at based on current PM assignment or as they were reported at the time.
Our database team created views for us where there are different fields to link between the FACT and the dimension tables based on historical keys or current keys. We use the USERELATIONSIP function in a calculation group where there are two items: Historical Reporting and Current Reporting. On the reporting layer we just add this to a slicer and everyone can switch it easily.
One calculation item is CALCULATE( SELECTEDMEASURE( ) ) and the other is
CALCULATE (SELECTEDMEASURE(), USERELATIONSHIP( TABLE_01[Field_01],'TABLE_02'[Field_02), USERELATIONSHIP( TABLE_01[Field_01],'TABLE_03[Field_03 )
This works really well until we hit 2 limitations of the USERELATIONSHIP function:
it does not work through RLS
it does not work with bidirectional filters (this is needed for the complicated models that are more like a snowflake model rather than star schema)
Any ideas are welcome, I am interested in any data models that perhaps allow for both slowly changing dimension and current dimension reporting, even if it means database view changes. Thank you!
In my opinion, instead of relying on USERELATIONSHIP, you can use a bridge table that can switch between the historical and current dimensions.
Another approach you can split the fact table into two separate tables one for current data and one for historical data.
2 Replies
- AmiraBedh
Super User
In my opinion, instead of relying on USERELATIONSHIP, you can use a bridge table that can switch between the historical and current dimensions.
Another approach you can split the fact table into two separate tables one for current data and one for historical data.
- AdrienneBFrequent Visitor
Thanks for the ideas. How does a bridge table work in this case? Can you please point me to a sample or write up?