Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
We have two fact tables - Payments and Customer Contacts. We would like to find out how many Payments are made within 6 days of a Customer Contact (a call or email from a collections staff member). Payments and Customer Contacts both relate to DimAccount, and both will have many records for each account.
FactPayments
DimAccountID
PaymentDate
PaymentAmount
FactCustomerContact
DimAccountID
DimCampaignID
ContactDate
This measure uses TREATAS to force this relationship, this allows be to display both dates together in a table.
But I can't seem to figure out how to filter this measure to only show Payments where the DATEDIFF between these dates is between 0 and 6.
Thanks!
@SeanGannon , one the way is to get the contract date in Fact payment
a new column
Con date= maxx(filter(Contract, Contract[DimAccountID] = payment[DimAccountID] && contract[ContactDate]< Payment[Payment Date]), Payment[Payment Date])
now you can only work with payment fact
countx(filter(payment, payment[Payment Date]<= [con date] +6 && payment[Payment Date]>= [con date] ), [DimAccountID])
There are (potentially) many contacts per payment, won't this force repeating records into FactPayment?
User | Count |
---|---|
25 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
30 | |
13 | |
11 | |
9 | |
6 |