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

# Calculated Channel reference

> Settings, options, and behaviors for Calculated Channels in Sift.

export const MintTable = ({columns = [], rows = [], columnWidths = []}) => {
  const pushTextWithLineBreaks = (parts, text, keyBase) => {
    const segments = String(text).split(/\\n|\n/);
    segments.forEach((segment, idx) => {
      if (segment) {
        parts.push(<span key={`${keyBase}-text-${idx}`}>{segment}</span>);
      }
      if (idx < segments.length - 1) {
        parts.push(<br key={`${keyBase}-br-${idx}`} />);
      }
    });
  };
  const parseMarkdown = text => {
    if (text === null || text === undefined) return "";
    const str = String(text);
    const parts = [];
    let lastIndex = 0;
    const pattern = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[([^\]]+)\]\(([^)]+)\))/g;
    let match;
    while (true) {
      match = pattern.exec(str);
      if (match === null) {
        break;
      }
      if (match.index > lastIndex) {
        pushTextWithLineBreaks(parts, str.substring(lastIndex, match.index), `before-${lastIndex}`);
      }
      const fullMatch = match[0];
      if (fullMatch.startsWith("`") && fullMatch.endsWith("`")) {
        parts.push(<code key={match.index}>{fullMatch.slice(1, -1)}</code>);
      } else if (fullMatch.startsWith("**") && fullMatch.endsWith("**")) {
        parts.push(<strong key={match.index}>{fullMatch.slice(2, -2)}</strong>);
      } else if (fullMatch.startsWith("*") && fullMatch.endsWith("*")) {
        parts.push(<em key={match.index}>{fullMatch.slice(1, -1)}</em>);
      } else if (fullMatch.startsWith("[")) {
        const linkText = match[2];
        const linkUrl = match[3];
        parts.push(<a key={match.index} href={linkUrl} className="text-black-600 dark:text-black-400">
            {linkText}
          </a>);
      }
      lastIndex = pattern.lastIndex;
    }
    if (lastIndex < str.length) {
      pushTextWithLineBreaks(parts, str.substring(lastIndex), `tail-${lastIndex}`);
    }
    if (parts.length > 0) {
      return parts;
    }
    const plainParts = [];
    pushTextWithLineBreaks(plainParts, str, "plain");
    return plainParts.length ? plainParts : str;
  };
  const safeColumns = Array.isArray(columns) ? columns : [];
  const safeRows = Array.isArray(rows) ? rows : [];
  const safeColumnWidths = Array.isArray(columnWidths) ? columnWidths : [];
  const hasColumnWidths = safeColumnWidths.some(w => w !== null && w !== undefined && w !== "");
  const toCssWidth = width => typeof width === "number" ? `${width}px` : String(width);
  const getColumnStyle = idx => {
    const rawWidth = safeColumnWidths[idx];
    if (rawWidth === null || rawWidth === undefined || rawWidth === "") {
      return undefined;
    }
    const width = toCssWidth(rawWidth);
    return {
      width,
      minWidth: width
    };
  };
  const containerStyle = hasColumnWidths ? undefined : {
    overflowX: "auto"
  };
  const tableStyle = hasColumnWidths ? {
    tableLayout: "fixed",
    width: "100%"
  } : {
    width: "max-content",
    minWidth: "100%"
  };
  if (!Array.isArray(columns) || !Array.isArray(rows) || !Array.isArray(columnWidths)) {
    console.warn("MintTable received invalid props:", {
      columns,
      rows,
      columnWidths
    });
  }
  if (!safeColumns.length && !safeRows.length) {
    return null;
  }
  return <div className="mint-table-container" style={containerStyle}>
      <table style={tableStyle}>
        {hasColumnWidths && <colgroup>
            {safeColumns.map((_, idx) => {
    const style = getColumnStyle(idx);
    return <col key={idx} style={style} />;
  })}
          </colgroup>}
        <thead>
          <tr>
            {safeColumns.map((col, idx) => <th key={idx} className="text-left" style={getColumnStyle(idx)}>
                <b>{parseMarkdown(col)}</b>
              </th>)}
          </tr>
        </thead>
        <tbody>
          {safeRows.map((row, rIdx) => {
    const safeRow = Array.isArray(row) ? row : [];
    return <tr key={rIdx}>
                {safeRow.map((cell, cIdx) => <td key={cIdx} style={getColumnStyle(cIdx)}>
                    {parseMarkdown(cell)}
                  </td>)}
              </tr>;
  })}
        </tbody>
      </table>
    </div>;
};

Calculated Channels are derived signals computed from one or more existing Channels using a CEL expression. They allow engineers to define custom metrics, transform raw telemetry, and derive new signals without modifying the original data. Once created, a Calculated Channel is available in Explore for visualization and as an input for Rules and other Calculated Channels.

Sift supports two types of transformations:

* **Stateless**: Processes each data point independently. Ideal for unit conversions and threshold checks.
* **Stateful**: Retains context over time using rolling windows. Useful for moving averages, rates of change, and trend detection.

## Settings

The following table describes each setting available when creating or editing a Calculated Channel.

<MintTable
  columns={['Setting', 'Description', 'Required']}
  columnWidths={['25%', '60%', '15%']}
  rows={[
['Calculated Channel name', 'The name of the Calculated Channel. Must be between 1 and 253 characters, start with a letter, and use only ASCII and supported characters.', 'Yes'],
['Calculated Channel description', 'A brief description of what the Calculated Channel computes.', 'No'],
['Asset name', 'The Asset the Calculated Channel applies to. Determines which Channels are available as inputs.', 'Yes'],
['Asset tag name', 'An optional tag used to apply the Calculated Channel to all Assets with the specified tag.', 'No'],
['Input Channels', 'One or more existing Channels or Calculated Channels used as inputs to the expression. Each input is assigned a shorthand variable (`$1`, `$2`, and so on) based on selection order.', 'Yes'],
['Query', 'The CEL expression that defines how the Calculated Channel is computed from the input Channels. For supported syntax, see [Expression syntax](/documentation/reference/expression-syntax).', 'Yes'],
['Units', 'The unit of measurement for the derived signal (for example, `°C`, `kWh`, `m/s`).', 'No'],
]}
/>

## Behavior

The following table describes known constraints and behaviors to be aware of when working with Calculated Channels.

<MintTable
  columns={['Limitation', 'Description']}
  columnWidths={['25%', '75%']}
  rows={[
['Bitfield Channels', 'Bitfield Channels are not supported as inputs for Calculated Channels.'],
['Nested Calculated Channels', 'Calculated Channels can be nested as inputs in other Calculated Channels up to 10 levels deep.'],
['Multiple time series', 'When an expression combines multiple Channels with different timestamps, Sift uses an as-of join strategy. For each unique timestamp, it uses the most recent available value from each Channel, allowing meaningful results even when data streams arrive at different rates.'],
['Return types', 'Expressions may return numeric or string results.'],
['Creation methods', 'Calculated Channels can be created through the UI and API.'],
]}
/>
