Delta comparisons are the signature feature of HRM dashboards — “How has this metric changed since last time?” Nearly half of all components (47%) include delta measures, showing users at a glance whether things are trending up ▲, down ▼, or staying flat ⬭.

💡 How Deltas Work

Deltas are calculated in Cube/BigQuery, not in TREVL. TREVL simply requests the pre-calculated delta measures and displays them.

Delta Measures

Measure Type Description
cube.weightedShare Number Current period value (e.g., 78.3)
cube.weightedShareDelta Number Numeric change vs. comparison period (e.g., +3.2)
cube.weightedShareDeltaLabel String Formatted label with direction indicator (e.g., “▲ 3,2 %”)
cube.weightedShareOfQuestion Number Score-level: aggregated share for a question
cube.weightedShareOfQuestionDelta Number Score delta
cube.weightedShareOfQuestionDeltaLabel String Score delta label

Period Dimensions

Dimension Description
cube.periodFilter Current survey period (e.g., “Jan 25”, “Jul 24”)
cube.periodCompare Comparison period (e.g., “Jul 23”, “Sep 23”)

📊 Bar Chart with Delta

The most common delta visualization. Shows horizontal bars with a scatter point indicating the comparison period value.

id: Q-193
type: chart
template: bar_chart_with_delta_skilledworkers
queries:
- context: target_group
  dimensions:
  - cube.periodFilter
  - cube.optionText
  - cube.periodCompare
  measures:
  - cube.weightedShare
  - cube.weightedShareDelta
  - cube.weightedShareDeltaLabel
  filters:
  - member: cube.questionKey
    operator: equals
    values:
    - Q-193
  - member: cube.periodFilter
    operator: equals
    values:
    - Jan 25
  - member: cube.periodCompare
    operator: equals
    values:
    - Jul 24
  computed:
  - name: pointPaddingInfo
    code: '0.1'
  - name: zIndexInfo
    code: '2'
  - name: name
    code: '"Zielgruppe"'
  - name: delta_label
    arguments:
      delta_label: "$cube.weightedShareDeltaLabel"
    code: delta_label
  - name: compare_label
    arguments:
      period: "$cube.periodCompare"
    code: "`Vergleich zu ${period}`"

Highcharts Configuration for Deltas

The delta template renders two series:

  1. Bar series — Current period values (colored bars)
  2. Scatter series — Comparison period markers (grey dots on yAxis: 1)
highchartsData:
  xAxis:
    max: 14
  series:
  # Main bar series
  - data:
      x: "$cube.optionText"
      y: "$cube.weightedShare"
    name: "$name"
    color: "$color"
    zIndex: "$zIndexInfo"
    pointPadding: "$pointPaddingInfo"
    pointPlacement: 0
  # Delta scatter series
  - data:
      x: "$cube.optionText"
      y: a                    # placeholder — resolved by template
    name: "$compare_label"
    type: scatter
    color: "#737373"
    yAxis: 1
    zIndex: "$zIndexInfo"

🎯 Score with Delta

Score components show a single headline number with a delta indicator below it.

id: CS-177
type: score
template: score_comp_with_delta_skilledworkers
queries:
- context: target_group
  measures:
  - cube.weightedShareOfQuestion
  - cube.weightedShareOfQuestionDelta
  - cube.weightedShareOfQuestionDeltaLabel
  filters:
  - member: cube.periodFilter
    operator: equals
    values:
    - Jan 25
  - member: cube.periodCompare
    operator: equals
    values:
    - Sep 23
  - member: cube.optionText
    operator: equals
    values:
    - ">>"
    - stimme zu

The score template renders:

🏷️ Delta Label Format

The weightedShareDeltaLabel measure returns a pre-formatted string:

Change Label
Increase > 0.05% ▲ 3,2 % (blue arrow)
Decrease > 0.05% ▼ 1,8 % (red arrow)
No significant change ⬭ 0,0 % (grey circle)

For custom delta labels (e.g., in postprocess), the pattern is:

const createDeltaLabel = (difference) => {
  if (Math.abs(difference) < 0.05) {
    return `<span style="color: lightgrey;">⬭</span> ${Math.abs(difference).toFixed(1).replace('.', ',')} %`;
  } else if (difference < 0) {
    return `<span style="color: red;">▼</span> ${Math.abs(difference).toFixed(1).replace('.', ',')} %`;
  } else {
    return `<span style="color: blue;">▲</span> ${Math.abs(difference).toFixed(1).replace('.', ',')} %`;
  }
};

📅 Period Naming Convention

Survey periods follow this format: Mon YY (3-letter German month + 2-digit year)

Period Survey Wave
Jan 25 January 2025 wave
Sep 24 September 2024 wave
Jul 24 July 2024 wave
Mrz 24 March 2024 wave
Nov 23 November 2023 wave

Comparison periods are typically 6-12 months earlier than the current period.