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
Hello!
I need to add a column to my table here for "Boat Offered" which is in my Mailers table.
Based on how the data model is setup, I know I need some dax, but not sure how to ensure what's returned is in fact:
1 - Before the date of Purchase in the Sales Table
2 - After looking at date of purchase, returning the "Boat Offered" in the most recent mailer sent
I have an in between table called Customers which I'm using to connect to both Sales and Mailers since I can't connect directly between Mailers and Sales
Link to PBI File
https://1drv.ms/u/s!AuheBS0uRNVlmDuvvA9tFfKPd_X7
Sales Table
Mailer Table
Table Needing Appending (Customer Table)
Solved! Go to Solution.
Hi @Anonymous
max date = CALCULATE(MAX(Sales[DealDate]),ALLEXCEPT(Sales,Sales[CustomerID]))2.Create a new table
Table = SUMMARIZE(Sales,Sales[CustomerID],Sales[max date])3.Create relationship as below
related_max = RELATED('Table'[max date])
5.create measures in "Mailers" table
Measure 2 = CALCULATE(MAX(Mailers[Campaign_Sent_Date]),ALLEXCEPT(Mailers,Mailers[CustomerID])) Measure 3 = IF ( MAX ( Mailers[related_max] ) <> BLANK (), CALCULATE ( MAX ( Mailers[Campaign_Sent_Date] ), FILTER ( ALLEXCEPT ( Mailers, Mailers[CustomerID] ), Mailers[Campaign_Sent_Date] < MAX ( Mailers[related_max] ) ) ) ) Measure 4 = IF ( MAX ( Mailers[CustomerID] ) <> BLANK () && MAX ( Mailers[related_max] ) <> BLANK () && [Measure 3] <> BLANK (), CALCULATE ( MAX ( Mailers[Boat Offered] ), FILTER ( ALLEXCEPT ( Mailers, Mailers[CustomerID] ), Mailers[Campaign_Sent_Date] = [Measure 3] ) ) )
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
max date = CALCULATE(MAX(Sales[DealDate]),ALLEXCEPT(Sales,Sales[CustomerID]))2.Create a new table
Table = SUMMARIZE(Sales,Sales[CustomerID],Sales[max date])3.Create relationship as below
related_max = RELATED('Table'[max date])
5.create measures in "Mailers" table
Measure 2 = CALCULATE(MAX(Mailers[Campaign_Sent_Date]),ALLEXCEPT(Mailers,Mailers[CustomerID])) Measure 3 = IF ( MAX ( Mailers[related_max] ) <> BLANK (), CALCULATE ( MAX ( Mailers[Campaign_Sent_Date] ), FILTER ( ALLEXCEPT ( Mailers, Mailers[CustomerID] ), Mailers[Campaign_Sent_Date] < MAX ( Mailers[related_max] ) ) ) ) Measure 4 = IF ( MAX ( Mailers[CustomerID] ) <> BLANK () && MAX ( Mailers[related_max] ) <> BLANK () && [Measure 3] <> BLANK (), CALCULATE ( MAX ( Mailers[Boat Offered] ), FILTER ( ALLEXCEPT ( Mailers, Mailers[CustomerID] ), Mailers[Campaign_Sent_Date] = [Measure 3] ) ) )
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you so much!
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 |