-
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 feedbacks archived per day * add the query of archived in main file * query archived feedbacks per day * query archived feedbacks per month
- Loading branch information
1 parent
133202c
commit 1fe3a4f
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
usage-analytics/create-analytics/feedbacks_archived_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,23 @@ | ||
WITH | ||
archived_feedbacks AS ( | ||
SELECT | ||
JSON_EXTRACT_SCALAR(DATA, "$.archived") AS archived, | ||
DATE_TRUNC(TIMESTAMP_MILLIS(CAST(JSON_EXTRACT_SCALAR(DATA, "$.createdAt") AS INT)), Month) AS Month | ||
FROM | ||
`firestore_export.feedback_raw_latest` | ||
WHERE | ||
JSON_EXTRACT_SCALAR(DATA, "$.archived") != "0" ) | ||
SELECT | ||
COUNT(*) feedbacks_archived, | ||
month, | ||
CASE | ||
WHEN archived ="1" THEN "Giver" | ||
WHEN archived ="2" THEN "Receiver" | ||
WHEN archived ="3" THEN "Both" | ||
END | ||
AS archived_for | ||
FROM | ||
archived_feedbacks | ||
GROUP BY | ||
archived_for, | ||
month |
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