Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions models/core_/fct__monthly__financials.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ WITH final AS (
{% if target.name == 'sf' %}
SELECT
date_trunc('month', sub_created_at) as date_month
, count(distinct org_id) as cnt_subscribers
, count(distinct org_id) + 1 as cnt_subscribers
, sum(sub_price) as sum_revenue
FROM {{ ref('dim__orgs') }}
WHERE sub_created_at is not NULL
Expand All @@ -35,7 +35,7 @@ WITH final AS (
{% elif target.name == 'db' %}
SELECT
date_trunc('month', sub_created_at) as date_month
, count(distinct org_id) as cnt_subscribers
, count(distinct org_id) + 1 as cnt_subscribers
, sum(sub_price) as sum_revenue
FROM {{ ref('dim__orgs') }}
WHERE sub_created_at is not NULL
Expand All @@ -44,7 +44,7 @@ WITH final AS (
{% elif target.name == 'bq' %}
SELECT
TIMESTAMP_TRUNC(sub_created_at, month) AS date_month,
COUNT(DISTINCT org_id) AS cnt_subscribers,
COUNT(DISTINCT org_id) + 1 AS cnt_subscribers,
SUM(sub_price) AS sum_revenue
FROM {{ ref('dim__orgs') }}
WHERE NOT sub_created_at IS NULL
Expand All @@ -53,7 +53,7 @@ WITH final AS (
{% else %}
SELECT
date_trunc('month', sub_created_at) as date_month
, count(distinct org_id) as cnt_subscribers
, count(distinct org_id) + 1 as cnt_subscribers
, sum(sub_price) as sum_revenue
FROM {{ ref('dim__orgs') }}
WHERE sub_created_at is not NULL
Expand Down
Loading