Build a Sales Funnel SQL Table in Zoho Analytics

Difficulty: Intermediate
Estimated reading time: 15 mins
Estimated implementation time: 45 mins

Sales Funnel SQL Table

Build a SQL table which makes for easy business analysis in Zoho Analytics. Create a Sales Funnel chart with this data.

				
					SELECT
		 /* --- This first instance is for all the new leads in the system --- */ 
         "Full Name" 'Name',
		 "Created Time" 'Date',
		 "Lead Source",
         /* --- If you do not already have it as a field in the Leads module, create the "Link to CRM" here using the CONCAT function --- */
		 "Link to CRM",
		 "Id" 'Record ID',
		 'New Leads' 'Category'
FROM  "Leads" 
UNION ALL
 SELECT
		 /* --- This second instance is for CONVERTED leads, essentially, new contacts --- */ 
         "Full Name" 'Name',
		 "Created Time" 'Date',
		 "Lead Source",
		 concat('YOUR_CONTACTS_BASE_URL', "Id"),
		 "Id" 'Record ID',
		 'Converted Leads' 'Category'
FROM  "Contacts" 
UNION ALL
 SELECT
		 c."Full Name" 'Name',
		 d."Created Time" 'Date',
		 c."Lead Source",
		 concat('YOUR_DEALS_BASE_URL', d."Id"),
		 d."Id" 'Record ID',
		 'New Deals' 'Category'
FROM  "Deals" d
JOIN "Contacts" c ON d."Contact Name"  = c."Id"  
UNION ALL
 SELECT
		 c."Full Name" 'Name',
		 d."Closing Date" 'Date',
		 c."Lead Source",
		 concat('YOUR_DEALS_BASE_URL', d."Id"),
		 d."Id" 'Record ID',
		 'Closed Deals' 'Category'
FROM  "Deals" d
JOIN "Contacts" c ON d."Contact Name"  = c."Id"  
WHERE	 d."Stage"  LIKE 'Closed Won'
				
			

Want to learn even more? Sign up for one of our Zoho courses!

Click here to copy these scripts. For more Zoho-wizardry, check out our GitHub page.

More Free Resources

Deluge Tips – Null Check

When scripting, ask yourself this question – will this value ever be null? If it’s a yes, that’s a place for a null check! Here are 3 tips and best practices to help you kickstart the habit.

Read More »