I'm trying to measure ROI of marketing campaigns. I've gained access to our Dynamics CRM system via odbc as the reporting feature in Dynamics CRM is balls.
Essentially there are 4 tables:
Campaigns
Leads
Opportunities
Opportunity Products
In a nutshell when a lead has shown interest in a product it gets converted to an opportunity and opportunity products are added and detail the sales pipeline.
My quandry is that often campaigns dates can overlap and the next campaign can contain the same leads as the previous one. To allocate an opportunity to a campaign I've decided the best solution is to use the Datediff function to work out when an opportunity was created and which campaign it is closest to. However I can't seem to get Access to ignore the oldest campaign as shown below.
I want to end up with something like this:
I've tried using the Min function but haven't had any luck.
Any suggestions would be great.
tia
Essentially there are 4 tables:
Campaigns
Leads
Opportunities
Opportunity Products
In a nutshell when a lead has shown interest in a product it gets converted to an opportunity and opportunity products are added and detail the sales pipeline.
My quandry is that often campaigns dates can overlap and the next campaign can contain the same leads as the previous one. To allocate an opportunity to a campaign I've decided the best solution is to use the Datediff function to work out when an opportunity was created and which campaign it is closest to. However I can't seem to get Access to ignore the oldest campaign as shown below.
Code:
Campaign Name Potential Customer Sales Pipeline Date Difference
Campaign 2 Opportunity 1 £5,759.00 2
Campaign 1 Opportunity 1 £5,759.00 24
I want to end up with something like this:
Code:
Campaign Name Potential Customer Sales Pipeline Date Difference
Campaign 2 Opportunity 1 £5,759.00 2
Campaign 3 Opportunity 3 £7,989.00 5
I've tried using the Min function but haven't had any luck.
Any suggestions would be great.
tia