Forum Discussion
Linking tables on date
- 8 years ago
Hi Benegade,
Assume the sample data below:
You can create a measure like this:
Measure = CALCULATE(SUM('Bookings'[Pax]),FILTER('Bookings',IF(MAX('MarketingActivity'[Appearance Date])<='Bookings'[BookedDate],DATEDIFF(MAX('MarketingActivity'[Appearance Date]),'Bookings'[BookedDate],DAY),BLANK())<3 &&'Bookings'[Destination]=MAX('MarketingActivity'[Destination])))
For more information, you can download attached pbix file. If it doesn't meet your requirement, please share some sample data with us and clarify corresponding results.
Best Regards,
Qiuyun Yu
Hi Benegade,
Assume the sample data below:
You can create a measure like this:
Measure = CALCULATE(SUM('Bookings'[Pax]),FILTER('Bookings',IF(MAX('MarketingActivity'[Appearance Date])<='Bookings'[BookedDate],DATEDIFF(MAX('MarketingActivity'[Appearance Date]),'Bookings'[BookedDate],DAY),BLANK())<3 &&'Bookings'[Destination]=MAX('MarketingActivity'[Destination])))
For more information, you can download attached pbix file. If it doesn't meet your requirement, please share some sample data with us and clarify corresponding results.
Best Regards,
Qiuyun Yu
Hi v-qiuyu-msft,
Thanks for the reply - that helped a lot.
I modified the formula slightly so that it excluded bookings made prior to the marketing date appearance, and found that I needed to replace the blank() with an emptry string because it was viewing blank as 0, but otherwise it worked perfectly.
The final formula which seems to be working for me is:
Measure = CALCULATE(SUM('Bookings'[Pax]),FILTER('Bookings',
IF(MAX('MarketingActivity'[Appearance Date])<='Bookings'[BookedDate],DATEDIFF(MAX('MarketingActivity'[Appearance Date]), 'Bookings'[BookedDate],DAY),"") <=3
&& IF(MAX('MarketingActivity'[Appearance Date])<='Bookings'[BookedDate],DATEDIFF(MAX('MarketingActivity'[Appearance Date]), 'Bookings'[BookedDate],DAY),"") >=0
&&'Bookings'[Destination]=MAX('MarketingActivity'[Destination])))
Kind regards,
Ben