-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add query shared feedbacks per month (#546)
- Loading branch information
1 parent
7e41aed
commit ef955d6
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
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
14 changes: 14 additions & 0 deletions
14
usage-analytics/create-analytics/shared_feedbacks_per_month.sql
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
WITH shared_feedbacks AS ( | ||
SELECT DATE_TRUNC(TIMESTAMP_MILLIS(CAST(JSON_EXTRACT_SCALAR(DATA, "$.createdAt") AS INT)), MONTH) AS month, | ||
JSON_EXTRACT_SCALAR(DATA, "$.status") AS status, | ||
JSON_EXTRACT_SCALAR(DATA, "$.shared") AS shared, | ||
FROM firestore_export.feedback_raw_latest | ||
WHERE JSON_EXTRACT_SCALAR(DATA, "$.status") = "done" | ||
) | ||
SELECT count(*) as nb_feedbacks, month, | ||
CASE | ||
WHEN shared ="true" THEN "shared feedback" | ||
WHEN shared="false" THEN "No shared feedback" | ||
END AS shared_category | ||
FROM shared_feedbacks | ||
group by month, shared_category |