Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
I am trying to create a report that shows the effect of advertising campaigns on products. i.e. how many units (or in my case, passengers booked) do we sell as the result of an advertising campaign.
I have two main tables which I have simplified for illustration. One table contains the marketing activity – this includes the date of the marketing, the media through which it was advertised, and the destination (product) that was advertised.
The second table contains all bookings, and includes booked date, destination (product), number of passengers booked etc.
What I want to be able to show, is for any given marketing appearance and destination, how many pax booked that destination within 3 days of the marketing appearance date. E.g. if there was a marketing appearance on 1/1/17 for New York, then I want to see all bookings for New York on the 1st, 2nd or 3rd of January 2017 and exclude all others.
The issue I am having is finding a way to link the marketing activity table to the bookings table as there is no unique identifier between the tables.
Any suggestions greatly appreciated.
Solved! Go to Solution.
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