Skip to content
Stand with Ukraine flag

Analyze Building Energy Usage and Carbon Emissions

Energy consumption is one of the largest operating expenses for commercial buildings, yet most facilities lack accurate, real-time visibility into where energy is used and what it costs. This guide shows how to build an analytic dashboard that breaks down energy usage by source and by area, enables year-over-year comparisons, and tracks carbon emissions — all with interactive filtering.

Task definition: Create an analytic dashboard to analyze energy consumption sources in a building and identify areas for improvement.

  • Table: energy consumption broken down by source (HVAC, lighting, plug loads, elevators, etc.)
  • Table: energy consumption broken down by area (offices, meeting rooms, kitchen, storage, etc.)
  • Bar chart: compare energy usage across sources
  • Bar chart: compare current and previous year with monthly breakdown
  • Card: total CO₂ emissions with comparison to the previous period and a 6-month sparkline
  • ThingsBoard dashboard combining all views with building-level filtering

Energy meters are installed in the building and connected to ThingsBoard via MQTT. Each meter has two attributes:

  • sourceType — energy consumption source (HVAC, lighting, plug loads, elevators, etc.)
  • area — installation area (office, meeting room, hall, kitchen, etc.)

Meters have relations to a Building asset, and buildings have relations to a Customer. This hierarchy enables aggregation at the device, area, building, or customer level.

Step 1: Table — energy consumption by source

Section titled “Step 1: Table — energy consumption by source”
  1. Create a Table view in Trendz.

  2. Add energyMeter.sourceType to the Columns section — this splits readings by source type.

  3. Add energyMeter.usageKWH to the Columns section with aggregation SUM.

  4. Add a calculated field with label Price, unit $, decimals 2:

    var price = uniq(building.energyPrice);
    var totalUsage = sum(energyMeter.usageKWH);
    return totalUsage * price;
  5. Add a calculated field with label CO2 emissions, unit kg CO2e, decimals 1:

    var emissionConversionFactor = 0.21233;
    var totalUsage = sum(energyMeter.usageKWH);
    return totalUsage * emissionConversionFactor;
  6. Add energyMeter.sourceType, energyMeter.area, and building to the Filters section.

  7. Open view settings → GeneralSort order:

    • Enable descending sorting
    • Sort column: usageKWH
  8. Set the default time range to This month.

  9. Save the view as Energy consumption by source.

Step 2: Table — energy consumption by area

Section titled “Step 2: Table — energy consumption by area”

Repeat Step 1, but replace energyMeter.sourceType with energyMeter.area in the Columns section. Save the view as Energy consumption by area.

Step 3: Bar chart — compare usage by source type

Section titled “Step 3: Bar chart — compare usage by source type”

Tables give exact numbers; a horizontal bar chart makes it faster to spot the top consumers at a glance.

  1. Create a Bar chart in Trendz.
  2. Add energyMeter.sourceType to the X-axis section.
  3. Add energyMeter.usageKWH to the Y-axis section.
  4. Add building to the Filters section.
  5. Open view settings → General → enable Horizontal Bar.
  6. Configure default sorting: descending by usageKWH.
  7. Set the default time range to This month.
  8. Save the view as Bar: energy use compare by sources.

Step 4: Bar chart — year-over-year comparison with monthly breakdown

Section titled “Step 4: Bar chart — year-over-year comparison with monthly breakdown”
  1. Create a Bar chart in Trendz.
  2. Add a Date field with type MONTH to the X-axis section.
  3. Add energyMeter.usageKWH to the Y-axis section.
  4. Add a Date field with type YEAR to the Series section — this splits bars by year.
  5. Add energyMeter.sourceType, energyMeter.area, and building to the Filters section.
  6. Set the default time range to Last 3 years.
  7. Save the view as Bar: compare year-to-year energy usage.

Step 5: Card — CO₂ emissions with trend

Section titled “Step 5: Card — CO₂ emissions with trend”
  1. Create a Card with line chart view in Trendz.

  2. Add a calculated field with label CO2 emissions, unit kg CO2e, decimals 1:

    var emissionConversionFactor = 0.21233;
    var totalUsage = sum(energyMeter.usageKWH);
    return totalUsage * emissionConversionFactor;
  3. Set the default time range to This month.

  4. Open General settings → enable Enable comparison — adds a percentage delta vs. the previous period.

  5. Enable Reverse comparison colors — green when emissions are lower, red when higher.

  6. Set the card title to CO2 emissions.

  7. Save the view as Card: CO2 emissions insights.

Step 6: Create the energy consumption dashboard in ThingsBoard

Section titled “Step 6: Create the energy consumption dashboard in ThingsBoard”

Combine all Trendz views into one interactive dashboard that any customer can use to explore their buildings.

  1. In ThingsBoard, create a dashboard named Energy consumption report.
  2. In Trendz, for each view created in Steps 1–5:
    • Click Share to ThingsBoard → copy Add on Dashboard.
    • Select the Energy consumption report dashboard.
    • Enable Create alias and choose Building as the filter entity.
  3. Back in ThingsBoard, open the dashboard and tune the layout.
  4. Create the alias All buildings:
    • Filter type: Asset type
    • Asset type: Building
  5. Create the alias Selected entity:
    • Filter type: Entity from dashboard state
    • State entity parameter name: selectedEntity
  6. Add a Cards → Entities table widget and set its datasource alias to All buildings. Add the Name key as a column.
  7. Add an On row click action to the entities table:
    • Action type: Update current dashboard state
    • State entity parameter name: selectedEntity
  8. For all Trendz widgets, set the datasource alias to selectedEntity.
  9. Save the dashboard.

The dashboard created in this guide gives facility managers a complete view of energy usage: which sources consume the most, which areas are the biggest contributors, how this year compares to last year by month, and what the building’s carbon footprint looks like. Interactive building filters make it easy to drill down from a portfolio view into a single site.