Forum Discussion
Relate 2 date fields from 2 different tables
Setup:
I have 2 tables with a Many to Many relationship on a subscriptionid. This is necessary because in the first table, there can be multiple lines with the same subscriptionid due to the same subscriptionid having multiple start dates (This is due to how our system works when they buy more licenses, those licenses have their own start date). This table tells us how how many licenses they have and what dates those licenses start at.
The other table is a trend table, containing every personid and the subscriptionid they belong to. Since its a trend table, you can have multiple of the same person/subscriptionid because I am keeping track of changes to their accounts and licenses. Its complicated but necessary for how we do business. I keep track of each change by using a ValidFrom and ValidTo date field.
Example: If a PersonId goes from being a Subscription Manager to an Admin, I track that with flags and what dates. When a change is found in the DB, the ValidTo line is updated and a new line is created with a new ValidFrom.
The Problem
What I need to do is relate the ValidFrom and ValidFrom to the SubscriptionStartDate and SubscriptionEndDate in the first table. I Have the Subscription table related to the Trend table using the SubscriptionId.
What I tried was a Calculate where I perform my COUNT on the PersonId field (In Trend Table) and then in the filters, I want to say this:
ValidFrom > SubscriptionStartDate AND ValidTo > SubscriptionEndDate (This is because the "current" entries in the Trend table have a ValidTo of 12-31-9999). However, when I do this, it doesnt recognize those fields as valid.
Subscription Table
SubscriptionTable
TrendTable
TrendTable
Relationship - its related on SubscriptionId
Related on SubscriptionId
Trying to do something like this
This is what Im trying to do in order to isolate the right rows.
1 Reply
- ThejeswarSuper User
Hi Anonymous ,
Try using a RELATED() DAX to access those column from Subscription table
Always share some sample data rather than a snapshot, that will help get your queries resolved faster in the community