Hi to everyone!
I'm creating a report that should group the leads by Industry Area and then show how many leads have been created and how many have been qualified in the last seven days.
So far I have been able to perform the first two steps in Visual Studio, but I cannot find any field related to the lead's qualification time and date in the CRM db.
This is the query I wrote:
SELECT industrycodename AS IndustryName, COUNT(industrycode) AS CreatedLastWeek
FROM FilteredLead AS CRMAF_FilteredLead
WHERE createdon > DATEADD(day, -7, CONVERT(datetime, CONVERT(char(10), GETDATE(),
101))) and DATEPART(week, createdon) = DATEPART(week, GETDATE())
GROUP BY industrycodename;
How could I add a third column with the number of qualified leads per Industry Area in the last seven days?