Created
April 16, 2018 16:56
-
-
Save preetamtt/37d4330a713a6870733be38a9dc237c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#standardsql | |
WITH agg1 AS( | |
SELECT device_category, result_position, COUNT(*) as num_conv | |
FROM sandbox.ir_ranking_conversation_td_apr13_18 | |
WHERE one_plus_conversation IS TRUE | |
GROUP BY 1,2 | |
), | |
agg2 AS ( | |
SELECT device_category, result_position, num_conv*100/total_conv as perc_total_conv | |
FROM agg1 a, (SELECT COUNT(*) as total_conv FROM sandbox.ir_ranking_conversation_td_apr13_18 WHERE one_plus_conversation IS TRUE) b | |
) | |
SELECT * FROM agg2 ORDER BY 3 DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment