Hello everybody,
I'm looking for a solution of a data modelling problem in SSAS Tabular 2017.
My tabular project is loaded from a SQL Server Database. The tables in the database are modelled as snapshots.
From a business point of view we're documenting possible cases that can lead to some damage for the business (power blackout, hardware failure, theft etc.) and what counteractions were taken to prevent these cases / decrease their damage.
The users enter (and delete) such events and counteractions once per month. So for each month we have a snapshot of possible damage cases and counteractions.
In the SQL database I have following tables:
1. Date (DateId int). One record for each month.
2. DamageCase (DateId int, DamageCaseId int, other columns). PK is (DateId, DamageCaseId).
3. Counteraction (DateId int, CounteractionId int, other columns). PK is (DateId, CounteractionId).
4. MapDamageCaseToCounteraction(DateId int, DamageCaseId int, CounteractionId int). It's a many-to-many table, so one damage case can have multiple counteractions. And one such action can counter several damage cases. It's also a snapshot
for each month.
In my tabular project I've defined following relationships:
1. OneDirection DamageCase->Date over DateId
2. BothDirections(!) DamageCase<->MapDamageCaseToCounteraction over (DateId, DamageCaseId). I had to make a single technical column from these two, because the relationships can only use one column, but it's not
important here.
3. OneDirection MapDamageCaseToCounteraction -> Counteraction over (DateId, CounteractionId).
With this model I can build following pivots using Excel as frontend:
1. DamageCases for a given Date
2. Historical development of a damage case (such as its estimated probability)
3. Overview of DamageCases with corresponding Counteractions
4. Overview of Counteractions which are registered for one or more DamageEvents.
What I cannot do is to make an overview of all Counteractions which are valid for a given date. Independent of the filter on the Date I always see all possible Counteractions, also the historical ones.
The only connection between Counteraction and Date tables goes over MapDamageCaseToCounteraction. I cannot add a relationship between Counteraction and Date because of "There are ambiguous paths between MapDamageCaseToCounteraction
and Date".
I have found a hack/workaround: Make a Relationship and set it to inactive. Make a "dummy" measure in the table Counteraction (such as Count()) and use the function USERELATIONSHIP to apply the inactive relationship between Counteraction
and Date.
Is there a better solution for this problem?
Thanks in advance.