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

# Product units

> Total quantity sold for a grouped product in the selected window.

| Contract           | Value                            |
| ------------------ | -------------------------------- |
| Metric key         | `app.top_products.units`         |
| Source             | Aloftly                          |
| Status             | active                           |
| Type               | application                      |
| Semantic version   | Application calculation          |
| Catalog visibility | Supporting or fixed-surface only |

## How it's calculated

```sql theme={null}
SUM(CASE WHEN trim(dimensions->>'quantity') matches a finite numeric value THEN quantity::numeric ELSE 0 END)
```

### Built from

* `Line item quantity`

## Known caveats

* Custom and deleted products can group by their retained line-item title.

## Where this appears

* Top Products table

<AccordionGroup>
  <Accordion title="Grain and identity" icon="ruler">
    One grouped product over the selected half-open date window.

    **Join and identity keys**

    * productTitle, then sku, variantTitle, variantId fallback
  </Accordion>

  <Accordion title="Filters and boundaries" icon="filter">
    * Organization/store/date predicates apply.
    * Malformed historical quantity strings contribute zero rather than failing the query.
  </Accordion>

  <Accordion title="Timezone, currency, and freshness" icon="clock">
    **Timezone.** Uses the order line recorded\_at timestamp and the selected UTC half-open window.

    **Currency.** Not applicable.

    **Freshness.** Refreshes after the daily product bulk publication or a deliberate history run.
  </Accordion>

  <Accordion title="Version history" icon="clock-rotate-left">
    | Date       | Change                                                       |
    | ---------- | ------------------------------------------------------------ |
    | 2026-07-21 | Moved product facts to the complete bulk line-item pipeline. |
  </Accordion>
</AccordionGroup>
