From 92dab65b5e955c0e20656d844a80319e1e230bf7 Mon Sep 17 00:00:00 2001 From: Jake Peterson Date: Wed, 30 Jul 2025 12:31:01 -0700 Subject: [PATCH] add explores --- models/demo/accounts.yml | 30 +++- models/demo/deals.yml | 377 ++++++++++++++++++++------------------- models/demo/tracks.yml | 2 +- 3 files changed, 218 insertions(+), 191 deletions(-) diff --git a/models/demo/accounts.yml b/models/demo/accounts.yml index af15e28..494a36a 100644 --- a/models/demo/accounts.yml +++ b/models/demo/accounts.yml @@ -4,19 +4,30 @@ models: meta: primary_key: account_id # This filter means that unless you are an admin, you can't see Enterprise account - sql_filter: ${lightdash.attributes.is_admin_saas_demo} = 'true' or segment != 'Enterprise' - description: List of all customer and prospective customer Accounts pulled from our CRM + sql_filter: ${lightdash.attributes.is_admin_saas_demo} = 'true' or segment != + 'Enterprise' + description: List of all customer and prospective customer Accounts pulled from + our CRM joins: - join: deals sql_on: ${accounts.account_id} = ${deals.account_id} type: inner - fields: [unique_deals, new_deals, won_deals, lost_deals, stage, average_amount, total_amount] + fields: + [ + unique_deals, + new_deals, + won_deals, + lost_deals, + stage, + average_amount, + total_amount + ] columns: - name: account_id description: "The Account ID from our database" meta: dimension: - type: number + type: string urls: - label: 'Open in CRM' url: https://demo_saas.com/example/account/${ value.raw } @@ -31,19 +42,22 @@ models: unique_smb_accounts: label: Unique SMB Accounts type: count_distinct - description: The unique number of accounts based on distinct Account IDs for accounts in the SMB Segment + description: The unique number of accounts based on distinct Account IDs for + accounts in the SMB Segment filters: - segment: 'SMB' unique_midmarket_accounts: label: Unique Midmarket Accounts type: count_distinct - description: The unique number of Midmarket accounts based on distinct Account IDs for accounts in the Midmarket Segment + description: The unique number of Midmarket accounts based on distinct Account + IDs for accounts in the Midmarket Segment filters: - segment: 'Midmarket' unique_enterprise_accounts: label: Unique Enterprise Accounts type: count_distinct - description: The unique number of accounts based on distinct Account IDs for accounts in the Enterprise Segment + description: The unique number of accounts based on distinct Account IDs for + accounts in the Enterprise Segment filters: - segment: 'Enterprise' - name: account_name @@ -60,4 +74,4 @@ models: description: "The market Segment for this account (SMB, Midmarket, Enterprise)" meta: dimension: - type: string \ No newline at end of file + type: string diff --git a/models/demo/deals.yml b/models/demo/deals.yml index 9a78ca8..882e4ad 100644 --- a/models/demo/deals.yml +++ b/models/demo/deals.yml @@ -1,188 +1,201 @@ version: 2 models: -- name: deals - meta: - description: All sales deals of any status, pulled from our CRM - primary_key: deal_id - explores: - deals_accounts: - required_attributes: - is_admin_saas_demo: "true" - label: 'Deals w/Accounts' - description: The Deals table with the Accounts table details included (only accessible by admins since it includes account names) - joins: - - join: accounts - relationship: many-to-one - sql_on: ${deals.account_id} = ${accounts.account_id} - deals_accounts_no_names: - label: 'Deals w/Accounts (no Names)' - description: The deals table with the Accounts table details included, except for names (to keep anonymous) - joins: - - join: accounts - relationship: many-to-one - sql_on: ${deals.account_id} = ${accounts.account_id} - fields: [industry, segment, unique_accounts, unique_smb_accounts, unique_midmarket_accounts, unique_enterprise_accounts] - metrics: - win_rate: - type: number - description: The percentage of deals that have been won - format: percent - sql: ${won_deals} / ${unique_deals} - spotlight: - visibility: show - categories: - - kpi - loss_rate: - type: number - format: percent - sql: ${lost_deals} / ${unique_deals} - win_vs_lost_ratio: - type: number - round: 2 - sql: ${lost_deals} / ${won_deals} - - columns: - - name: deal_id - description: "The unique identified for a Deal" - meta: - dimension: - type: string - metrics: - unique_deals: - type: count_distinct - groups: ['Deal Counts'] - description: Count unique deals based on Account ID (each account can only have one deal) - spotlight: - visibility: show - categories: - - kpi - - sales - new_deals: - type: count_distinct - groups: ['Deal Counts'] - description: Count unique deals based on the Account ID and filter to only deals in the New stage - filters: - - stage: 'New' - spotlight: - visibility: show - categories: - - kpi - - sales - qualified_deals: - type: count_distinct - groups: ['Deal Counts'] - description: Count unique deals based on the Account ID and filter to only deals in the Qualified stage - filters: - - stage: 'Qualified' - poc_deals: - type: count_distinct - groups: ['Deal Counts'] - description: Count unique deals based on the Account ID and filter to only deals in the PoC stage - filters: - - stage: 'PoC' - negotiation_deals: - type: count_distinct - groups: ['Deal Counts'] - description: Count unique deals based on the Account ID and filter to only deals in the Negotiation stage - filters: - - stage: 'Negotiation' - won_deals: - type: count_distinct - groups: ['Deal Counts'] - description: Count unique deals based on the Account ID and filter to only deals in the Won stage - filters: - - stage: 'Won' - spotlight: - visibility: show - categories: - - kpi - - sales - lost_deals: - type: count_distinct - groups: ['Deal Counts'] - description: Count unique deals based on the Account ID and filter to only deals in the Lost stage - filters: - - stage: 'Lost' - spotlight: - visibility: show - categories: - - sales - - name: account_id - description: "The Account ID from our database" - meta: - dimension: + - name: deals + meta: + description: All sales deals of any status, pulled from our CRM + primary_key: deal_id + explores: + deals_accounts: + required_attributes: + is_admin_saas_demo: "true" + label: 'Deals w/Accounts' + description: The Deals table with the Accounts table details included (only + accessible by admins since it includes account names) + sql_filter: ${TABLE}.stage in ('Lost','Won','New') + joins: + - join: accounts + relationship: many-to-one + sql_on: ${deals.account_id} = ${accounts.account_id} + deals_accounts_no_names: + label: 'Deals w/Accounts (no Names)' + description: The deals table with the Accounts table details included, except + for names (to keep anonymous) + joins: + - join: accounts + relationship: many-to-one + sql_on: ${deals.account_id} = ${accounts.account_id} + fields: + [ + industry, + segment, + unique_accounts, + unique_smb_accounts, + unique_midmarket_accounts, + unique_enterprise_accounts + ] + metrics: + win_rate: type: number - hidden: true - - - name: stage - description: "The deal stage (New, Qualified, PoC, Negotiation, Won, Lost)" - meta: - dimension: - type: string - additional_dimensions: - stage_order: - type: number - sql: case - when stage = 'New' then 1 - when stage = 'Qualified' then 2 - when stage = 'PoC' then 3 - when stage = 'Negotiation' then 4 - when stage = 'Won' then 5 - when stage = 'Lost' then 6 - end - - name: plan - description: "The plan the prospect is interested in (Basic or Professional)" - meta: - dimension: - type: string - colors: - 'Basic': "#C0C0C0" - 'Professional': "#FFD700" - - name: seats - description: "The number of seats they are purchasing" - meta: - dimension: + description: The percentage of deals that have been won + format: percent + sql: ${won_deals} / ${unique_deals} + spotlight: + visibility: show + categories: + - kpi + loss_rate: type: number - metrics: - total_seats: - type: sum - description: The sum of seats for selected deals - average_seats: - type: average - round: 0 - description: The average number of seats per deal for selected deals - - name: amount - description: "The deal amount based on plan price per seat multiplied by seats" - meta: - dimension: + format: percent + sql: ${lost_deals} / ${unique_deals} + win_vs_lost_ratio: type: number - format: '$#,##0' - metrics: - total_amount: - type: sum - description: The sum of deal amount for selected deals - format: '$#,##0' - spotlight: - visibility: show - categories: - - kpi - - sales - total_amount_thousands: - description: The sum of deal amount for selected deals, shown in thousands - format: '$#,##0,"K"' + round: 2 + sql: ${lost_deals} / ${won_deals} + + columns: + - name: deal_id + description: "The unique identified for a Deal" + meta: + dimension: + type: string + metrics: + unique_deals: + type: count_distinct + groups: [ 'Deal Counts' ] + description: Count unique deals based on Account ID (each account can only have + one deal) + spotlight: + visibility: show + categories: + - kpi + - sales + new_deals: + type: count_distinct + groups: [ 'Deal Counts' ] + description: Count unique deals based on the Account ID and filter to only deals + in the New stage + filters: + - stage: 'New' + spotlight: + visibility: show + categories: + - kpi + - sales + qualified_deals: + type: count_distinct + groups: [ 'Deal Counts' ] + description: Count unique deals based on the Account ID and filter to only deals + in the Qualified stage + filters: + - stage: 'Qualified' + poc_deals: + type: count_distinct + groups: [ 'Deal Counts' ] + description: Count unique deals based on the Account ID and filter to only deals + in the PoC stage + filters: + - stage: 'PoC' + negotiation_deals: + type: count_distinct + groups: [ 'Deal Counts' ] + description: Count unique deals based on the Account ID and filter to only deals + in the Negotiation stage + filters: + - stage: 'Negotiation' + won_deals: + type: count_distinct + groups: [ 'Deal Counts' ] + description: Count unique deals based on the Account ID and filter to only deals + in the Won stage + filters: + - stage: 'Won' + spotlight: + visibility: show + categories: + - kpi + - sales + lost_deals: + type: count_distinct + groups: [ 'Deal Counts' ] + description: Count unique deals based on the Account ID and filter to only deals + in the Lost stage + filters: + - stage: 'Lost' + spotlight: + visibility: show + categories: + - sales + - name: account_id + description: "The Account ID from our database" + meta: + dimension: + type: string + hidden: true + + - name: stage + description: "The deal stage (New, Qualified, PoC, Negotiation, Won, Lost)" + meta: + dimension: + type: string + additional_dimensions: + stage_order: + type: number + sql: case when stage = 'New' then 1 when stage = 'Qualified' then 2 when stage = + 'PoC' then 3 when stage = 'Negotiation' then 4 when stage = + 'Won' then 5 when stage = 'Lost' then 6 end + - name: plan + description: "The plan the prospect is interested in (Basic or Professional)" + meta: + dimension: + type: string + colors: + 'Basic': "#C0C0C0" + 'Professional': "#FFD700" + - name: seats + description: "The number of seats they are purchasing" + meta: + dimension: type: number - sql: round(${total_amount},-3) - average_amount: - type: average - description: The average deal amount for selected deals - format: '$#,##0.00' - spotlight: - visibility: show - categories: - - kpi - - name: created_date - description: "The date the deal was created" - meta: - dimension: - type: date - time_intervals: ['DAY', 'WEEK', 'MONTH', 'MONTH_NAME', 'YEAR', 'QUARTER'] \ No newline at end of file + metrics: + total_seats: + type: sum + description: The sum of seats for selected deals + average_seats: + type: average + round: 0 + description: The average number of seats per deal for selected deals + - name: amount + description: "The deal amount based on plan price per seat multiplied by seats" + meta: + dimension: + type: number + format: '$#,##0' + metrics: + total_amount: + type: sum + description: The sum of deal amount for selected deals + format: '$#,##0' + spotlight: + visibility: show + categories: + - kpi + - sales + total_amount_thousands: + description: The sum of deal amount for selected deals, shown in thousands + format: '$#,##0,"K"' + type: number + sql: round(${total_amount},-3) + average_amount: + type: average + description: The average deal amount for selected deals + format: '$#,##0.00' + spotlight: + visibility: show + categories: + - kpi + - name: created_date + description: "The date the deal was created" + meta: + dimension: + type: timestamp + time_intervals: [ 'DAY', 'WEEK', 'MONTH', 'MONTH_NAME', 'YEAR', 'QUARTER' ] diff --git a/models/demo/tracks.yml b/models/demo/tracks.yml index 88d79e2..91b1d61 100644 --- a/models/demo/tracks.yml +++ b/models/demo/tracks.yml @@ -63,4 +63,4 @@ models: 'DAY_OF_WEEK_NAME', 'MONTH_NAME', 'QUARTER_NAME' - ] \ No newline at end of file + ]