Progress bar section
A progress bar section displays a single aggregated value as a visual progress indicator, making it ideal for showing completion status, utilization rates, or performance against targets. Unlike grids or graphs that show multiple data points, a progress bar summarizes data into one representative value.
Progress bars are commonly used for:
- Capacity utilization (e.g., 75% of maximum capacity)
- Target achievement (e.g., 850 out of 1000 units produced)
- Average performance over a time period
- Percentage calculations (e.g., efficiency rate)
- Single aggregated metrics (current average, total, or latest value)
For progress bars, you need a query that returns:
- Exactly one row with one numeric value
- Aggregation functions (AVG, SUM, MAX, MIN, COUNT, LAST) to get a single result
- Optionally, percentage calculations to show progress toward a goal
Important: The query must return a single value. Multiple rows or fields cannot be displayed in a progress bar.
For more info on how to write queries, check the query differences for database and query examples
Basic example - Average value
This example calculates the average power consumption over a time period and displays it as a single value in the progress bar.
SELECT
MEAN("InputBuffer1_PowerKw") AS "Average Power"
FROM "oneWeek"."Line1"
WHERE time >= '2026-05-03T10:00:00+02:00'
AND time < '2026-05-03T11:00:00+02:00'
SELECT
AVG("inputbuffer1_powerkw") AS "Average Power"
FROM "docsdemo_timescale_wide"."line1"
WHERE time >= '2026-05-03 10:00:00+02'
AND time < '2026-05-03 11:00:00+02'
SELECT
AVG(value::numeric) AS "Average Power"
FROM "line1"
WHERE name = 'InputBuffer1_PowerKw'
AND time >= '2026-05-03 10:00:00+02'
AND time < '2026-05-03 11:00:00+02'
WITH wide_data AS (
SELECT
AVG(CASE WHEN name = 'InputBuffer1_PowerKw' THEN value::numeric END) AS buffer1
FROM "line1"
WHERE time >= '2026-05-03 10:00:00+02'
AND time < '2026-05-03 11:00:00+02'
AND name = 'InputBuffer1_PowerKw'
)
SELECT
buffer1 AS "Average Power"
FROM wide_data
Current value - Last datapoint
This example retrieves the most recent value, useful for showing current status or the latest measurement.
SELECT
LAST("InputBuffer1_PowerKw") AS "Current Power"
FROM "oneWeek"."Line1"
WHERE time >= '2026-05-03T10:00:00+02:00'
AND time < '2026-05-03T11:00:00+02:00'
SELECT
"inputbuffer1_powerkw" AS "Current Power"
FROM "docsdemo_timescale_wide"."line1"
WHERE time >= '2026-05-03 10:00:00+02'
AND time < '2026-05-03 11:00:00+02'
ORDER BY time DESC
LIMIT 1
SELECT
value::numeric AS "Current Power"
FROM "line1"
WHERE name = 'InputBuffer1_PowerKw'
AND time >= '2026-05-03 10:00:00+02'
AND time < '2026-05-03 11:00:00+02'
ORDER BY time DESC
LIMIT 1
WITH wide_data AS (
SELECT
time,
CASE WHEN name = 'InputBuffer1_PowerKw' THEN value::numeric END AS buffer1
FROM "line1"
WHERE time >= '2026-05-03 10:00:00+02'
AND time < '2026-05-03 11:00:00+02'
AND name = 'InputBuffer1_PowerKw'
ORDER BY time DESC
LIMIT 1
)
SELECT
buffer1 AS "Current Power"
FROM wide_data
WHERE buffer1 IS NOT NULL
Percentage calculation
This example calculates a percentage value, such as utilization rate or efficiency. Here we show the average power as a percentage of the maximum (peak) value during the same period.
SELECT
(MEAN("InputBuffer1_PowerKw") / MAX("InputBuffer1_PowerKw")) * 100 AS "Capacity Utilization %"
FROM "oneWeek"."Line1"
WHERE time >= '2026-05-03T10:00:00+02:00'
AND time < '2026-05-03T11:00:00+02:00'
SELECT
ROUND(((AVG("inputbuffer1_powerkw") / MAX("inputbuffer1_powerkw")) * 100)::numeric, 1) AS "Capacity Utilization %"
FROM "docsdemo_timescale_wide"."line1"
WHERE time >= '2026-05-03 10:00:00+02'
AND time < '2026-05-03 11:00:00+02'
SELECT
ROUND(((AVG(value::numeric) / MAX(value::numeric)) * 100)::numeric, 1) AS "Capacity Utilization %"
FROM "line1"
WHERE name = 'InputBuffer1_PowerKw'
AND time >= '2026-05-03 10:00:00+02'
AND time < '2026-05-03 11:00:00+02'
WITH wide_data AS (
SELECT
AVG(CASE WHEN name = 'InputBuffer1_PowerKw' THEN value::numeric END) AS avg_buffer1,
MAX(CASE WHEN name = 'InputBuffer1_PowerKw' THEN value::numeric END) AS max_buffer1
FROM "line1"
WHERE time >= '2026-05-03 10:00:00+02'
AND time < '2026-05-03 11:00:00+02'
AND name = 'InputBuffer1_PowerKw'
)
SELECT
ROUND(((avg_buffer1 / max_buffer1) * 100)::numeric, 1) AS "Capacity Utilization %"
FROM wide_data