FAQ: Usage Funnels - Build a Funnel from Multiple Tables 4

Thanks, it worked for me as well eventually :smiley:

1 Like

I am at the end of this project and cannot figure out what it wants me to do for the Microsoft Excel / Google Sheets bit. I’ve opened Google Sheets and linked the code into the spreadsheet but nothing is happening and I can’t continue in the course without it being checked off. Any advice?

nvm, just had to run the code again! sorry if I bothered anyone

Why would you copy the code tho? How is it useful then for Sheets?

Please someone reply to this

1 Like

For anyone confused how to proceed on this exercise you need to click run twice, once for both steps.

The whole '‘plug this data into a spreadsheet’ isn’t really useful, instead you can edit the code to show a proper percentage by multiplying each conversion query by 100 like so:

WITH funnels AS (
  SELECT DISTINCT b.browse_date,
     b.user_id,
     c.user_id IS NOT NULL AS 'is_checkout',
     p.user_id IS NOT NULL AS 'is_purchase'
  FROM browse AS 'b'
  LEFT JOIN checkout AS 'c'
    ON c.user_id = b.user_id
  LEFT JOIN purchase AS 'p'
    ON p.user_id = c.user_id)
SELECT 
browse_date,
COUNT(*) AS 'num_browse',
   SUM(is_checkout) AS 'num_checkout',
   SUM(is_purchase) AS 'num_purchase',
   (1.0 * SUM(is_checkout) / COUNT(user_id))*100 AS 'browse_to_checkout',
   (1.0 * SUM(is_purchase) / SUM(is_checkout))*100* AS 'checkout_to_purchase'
FROM funnels
GROUP BY 1
ORDER BY 1;

Editing the code and clicking run again will at least make you feel like you’ve done a second step. :slight_smile:

It could be useful if you don’t know how to export a table from SQL through code, it helps as it is we are requested to make a presentation on the data found on this project! Creating the presentation would be much easier for many people.
I find it quite nice that they actually required that since processing the data on our head is actually a thing which we end up skipping while getting through exercises.

This isn’t about exporting the table or making a presentation, it’s about calculating the conversion. They want you to manually copy/paste the data into a spreadsheet to do the calculation which is unnecessary since it can be done within the code.