---
title: "Table Aggregate"
description: "Aggregate data in a workspace table (groups, metrics, pagination)."
canonical_url: "https://docs.vettero.com/build/workflows/blocks/table/aggregate"
---
# Table Aggregate

> Aggregate data in a workspace table (groups, metrics, pagination).

<block-meta block="Yes" channels="Any" folder="table" group="Table" groupTo="/build/workflows/blocks/table" icon="i-lucide-chart-pie" pipe="Value" scope="Any" tool="Yes" type="table.aggregate">



</block-meta>

**Table Aggregate** summarizes rows in a [table](https://docs.vettero.com/data/tables). Filter first (**WHERE**), compute metrics, optionally **Group By**, then filter groups (**Having**), sort, and paginate.

Default pagination is **All**. Default operation is a **count**.

## Configure

<table>
<thead>
  <tr>
    <th>
      Setting
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        Table
      </strong>
    </td>
    
    <td>
      Workspace table (required)
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Filters (WHERE)
      </strong>
    </td>
    
    <td>
      Optional conditions on rows before grouping
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Aggregations
      </strong>
    </td>
    
    <td>
      Operations to compute — <strong>
        count
      </strong>
      
      , <strong>
        sum
      </strong>
      
      , <strong>
        avg
      </strong>
      
      , <strong>
        min
      </strong>
      
      , <strong>
        max
      </strong>
      
       — with a field (except count) and optional alias
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Group By
      </strong>
    </td>
    
    <td>
      Optional table field to group on
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Having
      </strong>
    </td>
    
    <td>
      Optional conditions on the grouped results
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Sort (ORDER BY)
      </strong>
    </td>
    
    <td>
      Optional sort on group results
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Pagination
      </strong>
    </td>
    
    <td>
      <strong>
        One
      </strong>
      
      , <strong>
        All
      </strong>
      
      , <strong>
        Limit/Skip
      </strong>
      
      , or <strong>
        Limit/Page
      </strong>
      
      . Default <strong>
        All
      </strong>
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Limit
      </strong>
      
       / <strong>
        Skip
      </strong>
      
       / <strong>
        Page
      </strong>
    </td>
    
    <td>
      Shown for Limit/Skip or Limit/Page
    </td>
  </tr>
</tbody>
</table>

## Handles

<table>
<thead>
  <tr>
    <th>
      Handle
    </th>
    
    <th>
      Role
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        In
      </strong>
      
       (target)
    </td>
    
    <td>
      Incoming connection
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Out
      </strong>
      
       (source)
    </td>
    
    <td>
      Continues after the aggregation
    </td>
  </tr>
</tbody>
</table>

## Pipe schema

The next block reads this on the data pipe (`pipe.value`). The value is an object:

<table>
<thead>
  <tr>
    <th>
      Key
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        rows
      </code>
    </td>
    
    <td>
      list
    </td>
    
    <td>
      One object per group. <code>
        _id
      </code>
      
       is the group key (null when there is no group). Each operation alias is a property
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        total
      </code>
    </td>
    
    <td>
      number
    </td>
    
    <td>
      Number of groups
    </td>
  </tr>
</tbody>
</table>

## Use case

- Count open tickets, or sum order amounts by status.
- Feed group rows into [For Of](https://docs.vettero.com/build/workflows/blocks/loops/for-of) to notify each category owner.

<block-page-nav>



</block-page-nav>


## Sitemap

See the full [sitemap](https://docs.vettero.com/sitemap.md) for all pages.
