oee.APQ() function

The oee.APQ() function is experimental and subject to change at any time. By using this function, you accept the risks of experimental functions.

The oee.APQ() function computes availability, performance, quality (APQ) and overall equipment effectiveness (OEE) in producing parts. Provide the required input schema to ensure this function successfully calculates APQ and OEE. oee.APQ() is an aggregate function.

import "experimental/oee"

    runningState: "running",
    plannedTime: 8h,
    idealCycleTime: 2m,

Required input schema

You must include the following columns in your production data input tables:

  • _stop: Right time boundary timestamp (typically assigned by range() or window()).
  • _time: Timestamp of the production event.
  • state: String that represents start or stop events or the production state.
  • partCount: Cumulative total of parts produced.
  • badCount: Cumulative total of parts that do not meet quality standards.

Output schema

For each input table, the oee.APQ function outputs a table with a single row that includes the following columns:

  • _time: Timestamp associated with the APQ calculation.
  • availability: Ratio of time production was in a running state.
  • oee: Overall equipment effectiveness.
  • performance: Ratio of production efficiency.
  • quality: Ratio of production quality.
  • runTime: Total nanoseconds spent in the running state..



(Required) State value that represents a running state.


(Required) Total time that equipment is expected to produce parts.

Integer values represent nanoseconds.


(Required) Ideal minimum time to produce one part.

Integer values represent nanoseconds.


Input data. Default is piped-forward data (<-). See Required input schema.


The following example uses production data (productionData) and oee.APQ() to calculate the APQ and OEE of an eight hour production window.

Input data (productionData)

_start _stop _time state partCount badCount
2021-01-01T00:00:00Z 2021-01-01T08:00:01Z 2021-01-01T00:00:00Z running 0 0
2021-01-01T00:00:00Z 2021-01-01T08:00:01Z 2021-01-01T04:03:53Z stopped 673 5
2021-01-01T00:00:00Z 2021-01-01T08:00:01Z 2021-01-01T04:24:53Z running 673 5
2021-01-01T00:00:00Z 2021-01-01T08:00:01Z 2021-01-01T08:00:00Z running 1298 13


import "experimental/oee"

productionData = // ...

    |> oee.APQ(runningState: "running", plannedTime: 8h, idealCycleTime: 21s)
    |> drop(columns: ["_start", "_stop"])

Output data

_time availability oee performance quality runTime
2021-01-01T08:00:01Z 0.9563 0.9370 0.9897 0.9899 27541000000000

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.