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

# Fleet Analytics

> Fleet performance metrics and trends at /fm/fleet/analytics with KPI cards, mileage and fuel cost charts, and a per-vehicle comparison table.

This screen provides fleet analytics and is available at `/fm/fleet/analytics`.

## Overview

The Fleet Analytics page uses `useFleetTrendData` for trend data and computes per-vehicle stats by querying `fm_fleet_mileage_logs`, `fm_fleet_fuel_logs`, and `fm_fleet_trips` directly via Supabase for each vehicle. A **Period** selector controls the analytics timeframe: Last 30 Days, Last 90 Days, Last 6 Months, Last Year. Five KPI stat cards display: **Total Miles**, **Total Fuel Cost**, **Avg MPG**, **Cost per Mile**, and **Total Trips**. Two charts are rendered: `FleetMileageTrendChart` and `FleetFuelCostChart` (both use trend data). A `FleetVehicleComparisonTable` shows per-vehicle: vehicle number, make, model, year, total miles, total fuel cost, avg MPG, cost per mile, and trip count.

## Who it's for

Requires permission `fm.dashboard.view`.

## Before you start

* Fuel logs, trip logs, and mileage logs must be recorded for meaningful analytics.
* The period selector defaults to the last 6 months.

## Steps

<Steps>
  <Step title="Open Fleet Analytics">Navigate to `/fm/fleet/analytics` via the Fleet menu.</Step>
  <Step title="Select a period">Use the Period dropdown to choose 30 days, 90 days, 6 months, or 1 year.</Step>
  <Step title="Review KPI cards">Check Total Miles, Total Fuel Cost, Avg MPG, Cost per Mile, and Total Trips.</Step>
  <Step title="Analyze trend charts">Review the Mileage Trend and Fuel Cost trend charts.</Step>
  <Step title="Compare vehicles">Scroll to the Vehicle Comparison table to compare per-vehicle performance metrics.</Step>
</Steps>

## Key concepts

* **Cost per mile** — `totalFuelCost / totalMiles` per vehicle for the selected period.
* **Trend period options** — `30d`, `90d`, `6m`, `1y` (values from `TrendPeriod` type).
* **Vehicle comparison data** — aggregated from three separate Supabase queries per vehicle run in parallel.

## Related

<Columns cols={2}>
  <Card title="Facilities & Inventory" icon="warehouse" href="/fm/overview">
    Facilities & Inventory core overview.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index">
    Documentation coverage and governance.
  </Card>
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/fm.tsx
  * src/cores/fm/pages/FleetAnalyticsPage.tsx
</Accordion>
