Skip to content

Commit 52252c5

Browse files
committed
a little cleanup
1 parent dee593b commit 52252c5

14 files changed

+80
-78
lines changed

models/demo/accounts.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ models:
2727
meta:
2828
dimension:
2929
type: number
30+
label: Account ID
3031
urls:
3132
- label: 'Open in CRM'
3233
url: https://demo_saas.com/example/account/${ value.raw }
@@ -76,10 +77,11 @@ models:
7677
meta:
7778
dimension:
7879
type: number
80+
hidden: true
7981
metrics:
8082
total_estimated_annual_recurring_revenue:
8183
type: sum
82-
label: "Total Estimated Annual Recurring Revenue"
84+
label: "Total Estimated ARR"
8385
description: "Sum of all estimated annual recurring revenue"
8486
format: 'usd'
8587

models/demo/activities.sql

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ WITH activities_raw AS (
1212

1313
FROM {{ ref('activities_raw') }}
1414

15-
), leads_raw AS (
15+
),
16+
17+
leads_raw AS (
1618

1719
SELECT
1820
lead_id
1921
, deal_id
2022

2123
FROM {{ ref('leads') }}
2224

23-
), final AS (
25+
),
26+
27+
final AS (
2428

2529
SELECT
2630
a.activity_id
@@ -34,7 +38,9 @@ WITH activities_raw AS (
3438
, l.deal_id
3539

3640
FROM activities_raw a
37-
LEFT JOIN leads_raw l
38-
ON CAST(a.lead_id as string) = l.lead_id
41+
LEFT JOIN leads_raw l
42+
ON CAST(a.lead_id as string) = l.lead_id
43+
44+
)
3945

40-
) SELECT * FROM final
46+
SELECT * FROM final

models/demo/activities.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ models:
3838
meta:
3939
dimension:
4040
type: string
41+
label: Activity ID
4142
metrics:
4243
total_activities:
4344
type: count
@@ -78,6 +79,7 @@ models:
7879
meta:
7980
dimension:
8081
type: string
82+
label: Lead ID
8183
lead_id_total_leads:
8284
label: Total Leads
8385
description: 'Count distinct of Lead id on the table Activities '
@@ -89,6 +91,7 @@ models:
8991
meta:
9092
dimension:
9193
type: string
94+
label: Deal ID
9295
lead_id_total_leads:
9396
label: Total Deals
9497
description: 'Count distinct of Lead id on the table Activities '
@@ -101,6 +104,7 @@ models:
101104
meta:
102105
dimension:
103106
type: string
107+
label: SDR Name
104108
- name: activity_type
105109
description: "Type of activity (Call, Email, Meeting, etc.)"
106110
tests:
@@ -156,5 +160,6 @@ models:
156160
groups: ['Call Metrics']
157161
avg_call_time:
158162
type: average
163+
label: Average call time
159164
description: "Average call time in seconds"
160165
groups: ['Call Metrics']

models/demo/deals.yml

Lines changed: 48 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,16 @@
1-
version: 2
21
models:
32
- name: deals
43
meta:
54
description: All sales deals of any status, pulled from our CRM
65
primary_key: deal_id
6+
order_fields_by: 'index'
77
ai_hint: |
88
CloseRate Kevin: This is your primary deals model for analyzing pipeline progression and win/loss performance.
99
Use this to measure stage-to-stage conversion (New → Qualified → PoC → Negotiation → Won/Lost), calculate win rates, and identify stalled deals.
1010
Key dimensions: `stage` (with stages: New, Qualified, PoC, Negotiation, Won, Lost), `created_date` (for cohort analysis).
1111
Core metrics: `win_rate` (won deals / total deals), stage-specific counts (`new_deals`, `qualified_deals`, `poc_deals`, `negotiation_deals`, `won_deals`, `lost_deals`), `total_amount`, `total_won_amount`.
1212
Critical for AE performance analysis. Focus on demo-to-close rates (PoC → Negotiation → Won conversion) and identifying aging deals at each stage.
1313
Default to line charts for trend analysis, with period-over-period comparisons using `created_date` dimensions.
14-
15-
explores:
16-
deals_accounts:
17-
required_attributes:
18-
is_admin_saas_demo: "true"
19-
label: 'Deals w/Accounts'
20-
description: The Deals table with the Accounts table details included (only accessible by admins since it includes account names)
21-
joins:
22-
- join: accounts
23-
relationship: many-to-one
24-
sql_on: ${deals.account_id} = ${accounts.account_id}
25-
deals_accounts_no_names:
26-
label: 'Deals w/Accounts (no Names)'
27-
description: The deals table with the Accounts table details included, except for names (to keep anonymous)
28-
joins:
29-
- join: accounts
30-
relationship: many-to-one
31-
sql_on: ${deals.account_id} = ${accounts.account_id}
32-
fields: [industry, segment, unique_accounts, unique_smb_accounts, unique_midmarket_accounts, unique_enterprise_accounts]
3314
3415
parameters:
3516
deal_value_toggle:
@@ -48,39 +29,16 @@ models:
4829
type: left
4930
relationship: one-to-many
5031

51-
metrics:
52-
win_rate:
53-
type: number
54-
description: The percentage of deals that have been won
55-
format: percent
56-
sql: ${won_deals} / NULLIF(${unique_deals}, 0)
57-
spotlight:
58-
visibility: show
59-
categories:
60-
- kpi
61-
ai_hint: |
62-
CloseRate Kevin: Use `win_rate` to measure overall deal closure effectiveness (won deals ÷ total deals).
63-
This is a core KPI for AE performance. Break down by time period (week, month, quarter) to identify trends.
64-
Compare period-over-period to spot declining win rates early. Pair with `loss_rate` to understand win/loss balance.
65-
loss_rate:
66-
type: number
67-
format: percent
68-
sql: ${lost_deals} / NULLIF(${unique_deals}, 0)
69-
win_vs_lost_ratio:
70-
type: number
71-
round: 2
72-
sql: ${lost_deals} / NULLIF(${won_deals}, 0)
73-
7432
columns:
7533
- name: deal_id
7634
description: "The unique identified for a Deal"
7735
meta:
7836
dimension:
7937
type: string
38+
label: Deal ID
8039
metrics:
8140
unique_deals:
8241
type: count_distinct
83-
groups: ['Deal Counts']
8442
description: Count unique deals based on Account ID (each account can only have one deal)
8543
spotlight:
8644
visibility: show
@@ -146,6 +104,38 @@ models:
146104
visibility: show
147105
categories:
148106
- sales
107+
win_rate:
108+
type: number
109+
description: The percentage of deals that have been won
110+
format: percent
111+
sql: ${won_deals} / NULLIF(${unique_deals}, 0)
112+
spotlight:
113+
visibility: show
114+
categories:
115+
- kpi
116+
ai_hint: |
117+
CloseRate Kevin: Use `win_rate` to measure overall deal closure effectiveness (won deals ÷ total deals).
118+
This is a core KPI for AE performance. Break down by time period (week, month, quarter) to identify trends.
119+
Compare period-over-period to spot declining win rates early. Pair with `loss_rate` to understand win/loss balance.
120+
groups: ['Rates & Ratios']
121+
loss_rate:
122+
type: number
123+
format: percent
124+
sql: ${lost_deals} / NULLIF(${unique_deals}, 0)
125+
groups: ['Rates & Ratios']
126+
win_vs_lost_ratio:
127+
type: number
128+
round: 2
129+
sql: ${lost_deals} / NULLIF(${won_deals}, 0)
130+
groups: ['Rates & Ratios']
131+
132+
133+
- name: created_date
134+
description: "The date the deal was created"
135+
meta:
136+
dimension:
137+
type: date
138+
time_intervals: ['DAY', 'WEEK', 'MONTH', 'MONTH_NAME', 'YEAR', 'QUARTER']
149139
- name: account_id
150140
description: "The Account ID from our database"
151141
meta:
@@ -190,23 +180,26 @@ models:
190180
meta:
191181
dimension:
192182
type: number
183+
hidden: true
193184
metrics:
194185
total_seats:
195186
type: sum
196187
description: The sum of seats for selected deals
188+
groups: ['Seats']
197189
average_seats:
198190
type: average
199191
round: 0
192+
groups: ['Seats']
200193
description: The average number of seats per deal for selected deals
201194
- name: amount
202195
description: "The deal amount based on plan price per seat multiplied by seats"
203196
meta:
204197
dimension:
205198
type: number
199+
hidden: true
206200
format: '$#,##0'
207201
metrics:
208202
total_amount:
209-
groups: ['Deal Amounts']
210203
type: sum
211204
description: The sum of deal amount for selected deals
212205
format: '$#,##0'
@@ -219,16 +212,16 @@ models:
219212
CloseRate Kevin: Use `total_amount` to measure total pipeline value across all deal stages.
220213
Track over time to monitor pipeline health and growth. Break down by `stage` to see value distribution across funnel stages.
221214
total_won_amount:
222-
groups: ['Deal Amounts']
223-
type: sum
224-
description: The sum of deal amount for won deals
225-
format: '$#,##0'
226-
filters:
227-
- stage: 'Won'
228-
ai_hint: |
229-
CloseRate Kevin: Use `total_won_amount` to measure actual closed revenue—your core revenue KPI.
230-
Track by time period (week, month, quarter) to monitor revenue trends. Compare period-over-period for growth analysis.
231-
spotlight:
215+
groups: ['Deal Amounts']
216+
type: sum
217+
description: The sum of deal amount for won deals
218+
format: '$#,##0'
219+
filters:
220+
- stage: 'Won'
221+
ai_hint: |
222+
CloseRate Kevin: Use `total_won_amount` to measure actual closed revenue—your core revenue KPI.
223+
Track by time period (week, month, quarter) to monitor revenue trends. Compare period-over-period for growth analysis.
224+
spotlight:
232225
visibility: show
233226
categories:
234227
- kpi
@@ -255,9 +248,3 @@ models:
255248
format: '$#,##0'
256249
filters:
257250
- stage: 'Won'
258-
- name: created_date
259-
description: "The date the deal was created"
260-
meta:
261-
dimension:
262-
type: date
263-
time_intervals: ['DAY', 'WEEK', 'MONTH', 'MONTH_NAME', 'YEAR', 'QUARTER']

models/demo/leads.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
tags=['closerate_kevin', 'tori']
33
) }}
44

5-
WITH source_data AS ( SELECT * FROM {{ ref ('marketing_leads') }}
5+
WITH source_data AS ( SELECT * FROM {{ ref ('marketing_leads') }}),
66

7-
), final AS (
7+
final AS (
88

99
SELECT
1010
CAST(lead_id AS STRING) AS lead_id -- primary key
@@ -31,4 +31,6 @@ WITH source_data AS ( SELECT * FROM {{ ref ('marketing_leads') }}
3131

3232
FROM source_data
3333

34-
) SELECT * FROM final
34+
)
35+
36+
SELECT * FROM final

models/demo/leads.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ models:
8080
meta:
8181
dimension:
8282
type: string
83+
label: Lead ID
8384
metrics:
8485
unique_lead_count:
8586
type: count_distinct
8687
description: "The unique number of leads based on distinct lead IDs"
87-
groups: ['Lead Counts']
8888
spotlight:
8989
visibility: show
9090
categories:
@@ -154,11 +154,13 @@ models:
154154
meta:
155155
dimension:
156156
type: string
157+
label: User ID
157158
- name: sdr
158159
description: "The Sales Development Representative assigned to the lead"
159160
meta:
160161
dimension:
161162
type: string
163+
label: "SDR"
162164
ai_hint: |
163165
CloseRate Kevin: Use `sdr` to analyze individual SDR performance. Critical for identifying top performers vs. underperformers.
164166
Combine with `conversion_rate`, `avg_days_to_convert`, or stage counts to measure rep effectiveness.
@@ -173,11 +175,11 @@ models:
173175
meta:
174176
dimension:
175177
type: string
178+
label: Deal ID
176179
metrics:
177180
unique_deal_count:
178181
type: count_distinct
179182
description: "The unique number of deals"
180-
groups: ['Counts']
181183
spotlight:
182184
visibility: show
183185
categories:

models/demo/tracks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ models:
2222
meta:
2323
dimension:
2424
type: string
25+
label: User ID
2526
metrics:
2627
unique_user_count:
2728
type: count_distinct
@@ -31,6 +32,7 @@ models:
3132
meta:
3233
dimension:
3334
type: string
35+
label: Track ID
3436
metrics:
3537
event_count:
3638
type: count_distinct

models/demo/users.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ models:
2626
meta:
2727
dimension:
2828
type: string
29+
label: User ID
2930
metrics:
3031
unique_users:
3132
type: count_distinct
@@ -50,6 +51,7 @@ models:
5051
meta:
5152
dimension:
5253
type: string
54+
label: Account ID
5355
- name: email
5456
description: "The email of the user"
5557
meta:

models/fanouts_examples/fanouts_accounts.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: 2
21
models:
32
- name: fanouts_accounts
43
description: |

models/fanouts_examples/fanouts_accounts_bridged_fanout.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: 2
21
models:
32
- name: fanouts_accounts_bridged_fanout
43
description: |

0 commit comments

Comments
 (0)