Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi everyone.
I'm quite new into DAX and I'm struggling with the following task.
I have two dimension tables -dimClients and dimDates, - and two fact tables: factSales and factCalls.
factCalls contains all the calls of potential leads, and factSales - all the sales.
I want to calculate all the sales that were generated by these leads after the date they called.
I use CALCULATE function (calculate (sum(factSales[SalesAmount])). I suggest that I need to apply two filters on dim tables:
1. filter on dimDate table - to keep only dates after the date of call stored in factCalls;
2. filter on imClients table - to keep only those clientID that exist in factCalls table.
But I cannot come up with the right formula.
Any hint will be much appreciated.
Solved! Go to Solution.
Hi, smoupre.
Thank you for the reply and for the hint you gave. I've come up with the solution that does the work:
LeadSales = CALCULATE([factSales];filter(dimClients;CONTAINS(factCalls;factCalls[ClientID];dimClients[ClientID]));filter(dimDates;dimDates[Date].[Date]>=MIN(factCalls[Date])))
I modified the formula you suggested as I needed only those sales, that occurred after the initial contact with the lead, i.e. starting from the date the lead appeared in the factCalls table.
And CONTAINS function does a great job filtering only those clients that appear in factCalls table.
Still thinking through the second part. I believe the first part you could handle with something like:
CALCULATE(SUM(factSales[SalesAmount]),FILTER(factSales,factSales[date]>MAX(factCalls[date])))
Hi, smoupre.
Thank you for the reply and for the hint you gave. I've come up with the solution that does the work:
LeadSales = CALCULATE([factSales];filter(dimClients;CONTAINS(factCalls;factCalls[ClientID];dimClients[ClientID]));filter(dimDates;dimDates[Date].[Date]>=MIN(factCalls[Date])))
I modified the formula you suggested as I needed only those sales, that occurred after the initial contact with the lead, i.e. starting from the date the lead appeared in the factCalls table.
And CONTAINS function does a great job filtering only those clients that appear in factCalls table.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |