Skip to content

Instantly share code, notes, and snippets.

@sbrissenden
Created May 7, 2019 22:39
Show Gist options
  • Save sbrissenden/f93ff83d254fc99ce4c4457d3e696554 to your computer and use it in GitHub Desktop.
Save sbrissenden/f93ff83d254fc99ce4c4457d3e696554 to your computer and use it in GitHub Desktop.

Revisions

  1. sbrissenden created this gist May 7, 2019.
    7 changes: 7 additions & 0 deletions predictions_churn.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    SELECT COUNT(distinct p.user_id)
    FROM `friendly--pix.projectId.firebase_predictions.YOUR_PACKAGE_NAME_ANDROID` p CROSS JOIN UNNEST (predictions)

    WHERE
    prediction_name = "churn"
    AND score > 0.7
    AND TIMESTAMP_TRUNC(p.prediction_time, DAY) = TIMESTAMP('2018-10-04')