Skip to main content

Stats

Stats are compact KPI cards that display a single aggregated value prominently on your dashboard. Use them to show totals, counts, averages, or other key metrics that users need to see at a glance.

Go to Areas, select an Area, then open the Dashboard tab.

Creating a stat

  1. In the Dashboard tab, locate the Stats / KPI cards section
  2. Click Add New Stat
  3. Fill in the required fields in the stat configuration form
  4. Optionally enable Where Clause or Having Clause to filter the data
  5. Click Done to add the stat to your dashboard

Stats appear in a grid at the top of the dashboard. Use Stat Width to control how many columns each stat occupies.


Settings reference

Basic settings

SettingDescription
TitleDisplay name shown on the stat card.
Stat IconIcon displayed alongside the value. Select from the icon picker.
CollectionThe collection to query data from. Only collections included in the Area are available.
DescriptionBrief explanation of what this metric represents. Shown below the value.
Stat WidthHow much horizontal space the stat occupies: Full Width (1/1), Half Width (1/2), One Third (1/3), One Fourth (1/4), or One Fifth (1/5).
Access VisibilityRestrict visibility to specific auth collections and roles.

Query configuration

SettingDescription
Query SourceQuery Builder for visual configuration, or Raw SQL Query for custom SQL.
AggregationThe aggregation function to apply: Count, Sum, Average, Minimum, or Maximum. Only available when using Query Builder.
FieldThe field to aggregate. Required for Sum, Average, Min, and Max. Not required for Count.
Raw SQL QueryCustom SQL query that returns a single value. Only available when Query Source is Raw SQL.

Format settings

SettingDescription
FormatHow to display the value: Number, Currency, Percent, or Duration.
Currency CodeThe currency code (for example, USD, EUR). Only shown when Format is Currency.
Symbol PositionWhere to place the currency symbol: Prefix (Before) or Suffix (After). Only shown when Format is Currency.

Access visibility

You can restrict who can see this specific stat card on the dashboard. This is useful for showing different metrics to different user roles (for example, admins vs. standard users).

  1. Click the Customize Access Control toggle to turn it on.
  2. Select the Auth Collection (for example, Users).
  3. Select the Roles that are allowed to see this stat.

Filtering data

You can filter the data used for the stat using Where Clause or Having Clause.

tip

When you reference Dashboard Filters defined for the area, the stat updates dynamically when users change filter values on the dashboard.

Where clause

Use Where Clause to filter records before aggregation. This is equivalent to a SQL WHERE statement.

  1. Click the Where Clause toggle to enable it.
  2. Click Add Condition to add filter rules.
FieldDescription
RequiredCheck to make this condition mandatory.
ConjunctionWHERE (first condition), AND, or OR.
FieldThe field to filter on.
Operatoris equal to, is not equal to, is greater than, is less than, is greater than or equal to, is less than or equal to, contains, does not contain, starts with, ends with, is in, is not in.
ValueThe value to compare against. Supports static Default values, Session Fields , and Dashboard Filters .

Having clause

Use Having Clause to filter results after aggregation. This is useful when you need to filter based on aggregated values.

  1. Click the Having Clause toggle to enable it.
  2. Click Add Condition to add filter rules.
FieldDescription
ConjunctionHAVING (first condition) or AND.
AggregatorThe aggregation function (Count, Sum, Avg, Min, Max).
FieldThe field to aggregate.
OperatorComparison operator (same as Where Clause).
ValueThe threshold value. Supports static values, Session Fields , and Dashboard Filters .

Query source options

Query Builder

The visual Query Builder lets you set up aggregations without writing SQL:

  1. Select the Collection to query
  2. Choose an Aggregation function
  3. Select a Field (except for Count, which counts all records)
  4. Optionally add Where/Having clauses

Raw SQL query

For complex queries, switch to Raw SQL:

  1. Set Query Source to Raw SQL Query
  2. Write a SQL query that returns a single numeric value
  3. The editor provides autocomplete for collection fields
warning

Raw SQL queries bypass the Query Builder's validation. Ensure your query returns exactly one value to avoid display issues.


Example

Pending orders count

Display the number of orders awaiting processing:

  • Title: Pending Orders
  • Collection: Customer Orders
  • Query Source: Query Builder
  • Aggregation: Count
  • Format: Number
  • Where Clause: status Equal pending

Total revenue (this month)

Show total revenue for the current month:

  • Title: Monthly Revenue
  • Collection: Orders
  • Query Source: Query Builder
  • Aggregation: Sum
  • Field: total_amount
  • Format: Currency
  • Currency Code: USD
  • Where Clause: created_at Greater Than 2024-01-01

See these pages for related dashboard configuration: