> ## Documentation Index
> Fetch the complete documentation index at: https://docs.duvo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Weekly Sales Report

> Build a Duvo agent that pulls CRM data, calculates KPIs, and distributes regional sales reports every Monday morning.

<Info>
  **Time to complete:** 20 minutes

  **Difficulty:** Intermediate

  **Prerequisites:** CRM/Sales platform access, Email or Slack connection, Spreadsheet connection

  **You'll build:** An agent that generates and distributes customized sales reports every week
</Info>

### Why Automate This?

**The Problem**: Sales managers spend Monday mornings pulling data from multiple systems, building spreadsheets, calculating metrics, and formatting reports. By the time reports are distributed, the data is already hours old. Different regions get different formats. And creating personalized views for each stakeholder is simply not feasible manually.

**The Solution**: A Duvo agent that automatically pulls sales data, calculates KPIs, generates formatted reports with regional filtering, and distributes them to the right stakeholders—all before anyone arrives Monday morning.

**Expected Results**:

* Eliminate 3-4 hours of manual report building per week
* Deliver reports by 7 AM Monday (before anyone asks)
* Provide personalized regional views for each manager
* Ensure consistent metrics and formatting
* Include week-over-week comparisons automatically

***

### What You'll Build

By the end of this tutorial, you'll have an agent that:

1. Pulls sales data from your CRM for the past week
2. Calculates key performance metrics and comparisons
3. Generates formatted reports with charts and highlights
4. Filters data by region for each recipient
5. Distributes via email and posts to Slack
6. Archives reports in your shared drive

***

### Before You Start

Make sure you have these ready:

<Check>**CRM/Sales platform** - Salesforce, HubSpot, or similar. [Set up logins](/user-guide/resources/my-logins)</Check>
<Check>**Email connection** - For distributing reports. [Add a connection](/user-guide/connections/how-to-add-connection)</Check>
<Check>**Google Sheets or Excel** - For generating formatted reports</Check>
<Check>**Slack connection** (optional) - For posting summaries</Check>
<Check>**Google Drive or SharePoint** (optional) - For archiving reports</Check>

***

<Steps>
  <Step title="Create Your Agent" icon="plus">
    1. Click **"+ Create Agent"** from your dashboard
    2. Select **"Use Agent Builder"** (recommended for this tutorial)

    <Frame>
      <img src="https://mintcdn.com/duvo-d8027998/vP3-0V6Q0VBvZeLx/images/user-guide/building-agents/how-to-build-agent-1.png?fit=max&auto=format&n=vP3-0V6Q0VBvZeLx&q=85&s=739447e40cb95aae0c4553b794a8ef84" alt="Create Agent Button" width="510" height="526" data-path="images/user-guide/building-agents/how-to-build-agent-1.png" />
    </Frame>
  </Step>

  <Step title="Describe Your Workflow" icon="pencil">
    Paste this prompt into the Agent Builder:

    ```
    Every Monday at 6:00 AM, generate and distribute weekly sales reports.

    Step 1: Gather sales data from our CRM for the past 7 days
    - New deals created
    - Deals closed (won and lost)
    - Pipeline value changes
    - Revenue recognized
    - Meetings held
    - Calls made

    Step 2: Calculate key metrics
    - Total revenue for the week
    - Week-over-week growth percentage
    - Average deal size
    - Win rate (closed won / total closed)
    - Pipeline coverage ratio
    - Forecast accuracy vs actual

    Step 3: Generate the report
    Create a formatted report including:
    - Executive summary with top 3 highlights
    - Revenue breakdown by product line
    - Top 5 deals closed this week
    - Pipeline status and 30/60/90 day forecast
    - Team performance leaderboard
    - At-risk deals requiring attention
    - Comparison to same week last year

    Step 4: Create regional versions
    Generate separate reports for:
    - West Region (CA, OR, WA, NV, AZ)
    - East Region (NY, NJ, PA, MA, CT)
    - Central Region (TX, IL, OH, MI, GA)
    - Include only deals from each region's territories

    Step 5: Distribute reports
    - Send regional reports to respective Regional Sales Managers
    - Send company-wide summary to VP of Sales and CEO
    - Post highlights summary to #sales-team Slack channel
    - Save all reports to the Sales Reports folder in Google Drive with date stamp

    Step 6: Log completion
    Record report generation timestamp and any data quality issues encountered.

    If CRM data appears incomplete (less than 50% of typical weekly volume), send alert to sales operations before distributing reports.
    ```

    Click **"Generate"** to create the agent AOP.
  </Step>

  <Step title="Review Generated AOP" icon="clipboard-check">
    Review to ensure:

    * All metrics are correctly defined
    * Regional territories match your organization
    * Distribution list is accurate
    * Report format meets your needs
  </Step>

  <Step title="Upload Report Template" icon="file-up">
    Create a consistent look by uploading a template:

    1. Go to **Agent Settings** > **Files**
    2. Upload your report template (Excel or Google Sheets format)
    3. Include your company branding, chart styles, and section layouts
  </Step>

  <Step title="Configure Connections" icon="plug">
    Click **"Connections"** and connect:

    1. **CRM** - Salesforce, HubSpot, or your sales platform
    2. **Google Sheets or Excel** - For report generation
    3. **Email** - For distribution
    4. **Slack** (optional) - For team notifications
    5. **Google Drive or SharePoint** (optional) - For archiving
  </Step>

  <Step title="Test Your Agent" icon="play">
    Run a manual test before scheduling:

    1. Click **"Run Agent"**
    2. Review the generated report for accuracy
    3. Verify regional filtering is correct
    4. Check that all recipients received their reports

    <Frame>
      <img src="https://mintcdn.com/duvo-d8027998/vP3-0V6Q0VBvZeLx/images/user-guide/running-agents/how-to-run-agent-1.png?fit=max&auto=format&n=vP3-0V6Q0VBvZeLx&q=85&s=9370037e9a29d7a673787038c669305e" alt="Agent Running" width="860" height="794" data-path="images/user-guide/running-agents/how-to-run-agent-1.png" />
    </Frame>

    **What to check**:

    * Are the numbers accurate vs your CRM?
    * Is the regional breakdown correct?
    * Did the formatting look right?
    * Were all stakeholders included?
  </Step>

  <Step title="Schedule Weekly Runs" icon="calendar">
    Set up the Monday morning schedule:

    1. Go to **Agent Settings** > **Schedule**
    2. Select **Weekly** on **Monday** at **6:00 AM**
    3. Choose your timezone
    4. Save settings

    Your agent will now generate and distribute reports automatically every Monday.
  </Step>
</Steps>

***

### Expected Results

When your agent runs successfully, you should see:

**In stakeholder inboxes** (by 7 AM Monday):

* Formatted PDF reports with charts
* Executive summary highlighting key wins and concerns
* Week-over-week comparisons
* Regional breakdown specific to their territory

**In Slack #sales-team**:

* Quick highlights summary
* Link to full report
* Celebration of top performers

**In Google Drive/SharePoint**:

* Archived reports with date stamps
* Historical data for trend analysis
* Accessible to entire sales organization

**In Duvo**:

* Execution log with timing
* Data quality alerts if applicable
* Distribution confirmation

***

### Troubleshooting

<AccordionGroup>
  <Accordion title="Report shows wrong numbers" icon="calculator">
    * **Date range**: Verify timezone settings match your CRM
    * **Filters**: Check that all deal stages are included
    * **Currency**: Ensure consistent currency conversion if international
    * **Duplicates**: Confirm deals aren't being counted multiple times
  </Accordion>

  <Accordion title="Regional data is incorrect" icon="map">
    * **Territory mapping**: Verify state/country agents in AOP
    * **Account agent**: Check that accounts have correct region tags in CRM
    * **New territories**: Update AOP when territories change
  </Accordion>

  <Accordion title="Report formatting issues" icon="table">
    * **Template**: Ensure template is properly formatted and compatible
    * **Data types**: Verify numbers are formatted as numbers, dates as dates
    * **Chart data ranges**: Check that charts reference correct cells
  </Accordion>

  <Accordion title="Emails not delivering" icon="mail-x">
    * **File size**: Large reports may be blocked—consider Drive links instead
    * **Recipients**: Verify email addresses are current
    * **Spam filters**: Check corporate spam filters for attachments
  </Accordion>

  <Accordion title="Slack posts failing" icon="message-square-x">
    * **Channel permissions**: Ensure agent has permission to post
    * **Message length**: Slack has character limits—keep summaries concise
    * **Bot configuration**: Verify Slack app is properly installed
  </Accordion>
</AccordionGroup>

***

### Take It Further

Once your basic agent is working, consider these enhancements:

<AccordionGroup>
  <Accordion title="Add forecast accuracy tracking" icon="target">
    ```
    Compare this week's closed revenue to what was forecasted 4 weeks ago.
    Calculate forecast accuracy percentage for each rep.
    Highlight reps with >90% accuracy as "Reliable Forecasters".
    Include 4-week forecast accuracy trend in the report.
    ```
  </Accordion>

  <Accordion title="Create exception alerts" icon="triangle-alert">
    ```
    If any of these conditions are met, send immediate Slack alert to VP of Sales:
    - Week-over-week revenue down more than 20%
    - Win rate below 15%
    - Pipeline coverage below 2x
    - Any deal over $100K marked "at risk"
    ```
  </Accordion>

  <Accordion title="Add competitive intelligence" icon="swords">
    ```
    Include a section on deals lost to competitors this week.
    Group by competitor and identify patterns.
    Calculate loss rate by competitor over past 90 days.
    ```
  </Accordion>

  <Accordion title="Generate rep scorecards" icon="award">
    ```
    Create individual performance scorecards for each rep:
    - Revenue vs quota percentage
    - Activity metrics (calls, emails, meetings)
    - Pipeline health
    - Forecast accuracy
    Send each rep their personal scorecard along with team report.
    ```
  </Accordion>

  <Accordion title="Personalize with Agent Memory" icon="brain">
    Regional managers can customize their reports. [Learn about Agent Memory](/user-guide/assignment-features/assignment-memory)

    * West Region Manager: *"Only include data for California, Oregon, and Washington territories. Highlight accounts over \$50K in annual value. Send the report to my regional team at 6 AM Pacific."*
    * East Region Manager: *"Only include data for New York, New Jersey, and Pennsylvania territories. Highlight accounts over \$100K in annual value. Send the report to my regional team and VP of Sales."*
  </Accordion>
</AccordionGroup>

***

### Related Resources

<CardGroup cols={2}>
  <Card title="Agent Memory" icon="brain" href="/user-guide/assignment-features/assignment-memory">
    Customize reports for each stakeholder
  </Card>

  <Card title="Files" icon="folder" href="/user-guide/assignment-features/files">
    Upload report templates and formatting guides
  </Card>

  <Card title="Connections Overview" icon="plug" href="/user-guide/connections/connections-overview">
    Connect your CRM and communication tools
  </Card>

  <Card title="Human-in-the-Loop" icon="user-check" href="/user-guide/assignment-features/human-in-the-loop">
    Review reports before distribution
  </Card>
</CardGroup>
