---
name: ltx-sales-daily-report
description: "Generate LTX Studio sales opportunities report and credit limit alerts. Covers pipeline by rep/product (yesterday + QTD), new PELs/PQLs, future meetings, and enterprise orgs at 80%+ token usage. Use when: sales standup, pipeline review, account health check, or when asked for 'sales numbers' or 'credit alerts'."
tags: [reporting, daily-metrics, ltxstudio, sales, enterprise, credit-alerts]
compatibility:
  - bq CLI installed and authenticated
  - GCP project access (ltx-dwh-explore for query execution)
metadata:
  author: dbeer
  version: "2.0"
  created: "2026-03-13"
---

# LTX Sales Daily Report

## Overview

Two reports delivered to `#ltx-sales-auto-report`:

1. **Sales Opportunities** — Pipeline by rep and product (yesterday + QTD), new PELs/PQLs, future meetings
2. **Credit Limit Alerts** — Enterprise orgs at 80%+ token usage (active in last 7 days)

## Instructions

### Part A: Sales Opportunities Report

#### Step 1: Run the Query

```bash
bq --project_id=ltx-dwh-explore query --use_legacy_sql=false --format=pretty "$(cat queries/sales_opportunities_daily_report.sql)"
```

The query returns:

1. **Opportunities Created Yesterday** — by product (LTX Studio, LTX Model, LTX Scaler) and rep
2. **Opportunities Created This Quarter** — by product and rep
3. **New PELs/PQLs** — yesterday's new leads
4. **Future Meetings** — by product and source

**Key tables:**
- `ltx-dwh-prod-processed.marketing.final_sf_lead_opportunity`
- `ltx-dwh-prod-processed.web.pql_ltxstudio_leads_for_sf`

#### Step 2: Format Output

Format per `references/report-template.md` (Sales Opportunities section).

### Part B: Credit Limit Alerts

#### Step 1: Run the Query

```bash
bq --project_id=ltx-dwh-explore query --use_legacy_sql=false --format=pretty "$(cat queries/credit_limit_alerts_by_org_active.sql)"
```

Only orgs active in last 7 days at 80%+ usage.

#### Step 2: Format Output

Format per `references/report-template.md` (Credit Limit Alerts section).

**Enterprise segmentation logic:** See `shared/bq-schema.md`

## Context & References

### Shared Knowledge (Read First)
- **`shared/product-context.md`** — LTX Studio overview, user types, business model

### Query Files
- **`queries/credit_limit_alerts_by_org_active.sql`** — Credit limit alerts (active orgs only)

### Reference Materials
- `references/sales-opportunities-spec.md` — Opportunities query structure and tables
- `references/report-template.md` — Output formatting example

## Constraints

### DO NOT
- Run queries without `--project_id=ltx-dwh-explore`
- Use `is_enterprise_user` flag — use org-based enterprise logic
- Modify enterprise segmentation logic (McCann split, org list)

### DO
- Filter `ltx_studio = true` on sales funnel table
- Filter `opportunity_id is not null` for actual opportunities only
- Use `SAFE_DIVIDE` for all percentage calculations
- Use org-based enterprise logic from segmentation CTE

## Examples

```
User: "Sales opportunities report"
User: "Show me the pipeline by rep"
User: "Credit limit alerts"
User: "Which enterprise accounts are near their credit limit?"
User: "Run the sales report"
```
