Leads by Source Campaign (in current year)

Dynamics CRM


Dynamics CRM is a widely used cloud CRM from Microsoft, focused on Sales, Marketing, and Service (help desk) sectors.

Allows to see the number leads generated by each campaign run in the current year

Query Text

SELECT campaign_leads.name, COUNT(*) AS "Leads Count"
  FROM lead
LEFT OUTER JOIN campaign AS campaign_leads ON lead.campaignid = campaign_leads.campaignid
WHERE (date(date(lead.createdon), 'start of year') = date('now', 'localtime', 'start of year'))
GROUP BY campaign_leads.name
ORDER BY campaign_leads.name DESC

Open Query