Forum Discussion

kbol's avatar
kbol
Helper I
6 years ago
Solved

Data Modeling: Dimension Table with Component from Another Dimension

I'm in the process of trying to transform a semi-relational data model into a star schema for PowerBI and have been stumped by a situation where one dimension is a component of another.

The two dimensions conceptually are Staff and Date. The problem is that Staff have different roles, which is a criteria we want to slice on. A staffperson can have multiple roles at any given time and those roles can also change with time. Consequently, it is insufficient to simply have two unrelated dimensions because if a staffperson has ever had more than one role, they'll get counted for both in all facts. 

What I tried to do was create a table that has one row for each role a staffperson had on a given day to act as the Staff dimension, related to the fact table on the Staff field. Then I created a relationship from the Date dimension to that Staff table (admittedly breaking the star schema idea) and attempted to add a second relationship from the Date dimension to the fact table. Unfortunately, PowerBI views this as an ambiguous relationship. The behavior I am wanting is that a given Date selection filters both the Staff rows to the roles they had on any given day and filters the fact table to facts occuring within that selection.

I've cerated a toy test report that appears to work using this approach, but unfortunately it will require a bunch of USERELATIONSHIP measures which is what I am seeking to avoid. How can I model this situation more correctly?

4 Replies