The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
---|---|
28 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
35 | |
14 | |
12 | |
9 | |
7 |