Tutorial: Create a Unit Cost Dashboard

A cloud bill shows your raw spend. Unit economics shows what it truly costs to do business: the price of each customer order, API call, or transaction, and whether that number is moving the right way as you scale. A day where total cost jumps from $10,000 to $15,000 looks scary, but if transactions tripled in the same window, your cost per transaction may have dropped from $0.05 to $0.025. That's a good problem to have, and unit economics is what tells you that.

In this tutorial you'll set that up for a fictional food delivery company, EatIn, by tracking the cost of each customer order broken down by engineering team. About 10 minutes, plus up to 24 hours for CloudZero to ingest your unit metric data.

Here's what you'll have at the end:

A finished CloudZero Dashboard showing cost per order broken down by engineering team

What you need

  • A CloudZero account with permission to create telemetry streams and Dashboards.
  • A connected cloud provider (AWS, Azure, GCP, or any other supported source).
  • A Custom Dimension named Engineering Team with elements for each team. See Dimensions to set one up.
  • The example CSV file for this tutorial. It contains daily order counts per engineering team for September 2024.

Step 1: Send your unit metric data

CloudZero needs your unit metric data (the number of orders per team per day) to calculate cost per order. This data comes from your business systems like logs, databases, or observability tools. It is not part of your cloud bill. You'll send it as a CSV upload.

When you're ready to track a metric for your own business, see Where to find your unit metric for source ideas.

CSV files for unit metric streams need at least a timestamp column and a unit value column. Additional columns (like the Engineering Team column here) let you break the metric down by Dimension.

If you'd rather send data via API or manage streams in bulk, see Send unit cost and allocation data. This tutorial uses the CSV path.

  1. Go to Settings > Telemetry Streams, then select Create New Stream > New Unit Cost Metric.
  2. Enter the stream name engineering-team-orders and a description like Number of orders per engineering team per day.
  3. Set Granularity to Daily. This matches the daily order counts in the CSV and tracks day-by-day changes.
  4. Upload the example_data.csv file.
  5. Set Timestamp to Date.
  6. Set Unit value to Number of Orders.
  7. Set Target Dimension to Engineering Team.
  8. Set Dimension Element to the Engineering Team column.
  9. Select Save.
Completed unit cost stream configuration

CloudZero starts ingesting your data. It can take up to 24 hours for the stream to become Available on the Telemetry Streams page. While you wait, the stream shows as Pending.

Step 2: Build the Dashboard

Once your stream is Available, you can visualize your unit cost in Analytics.

  1. Go to Analytics and select Create Dashboard.
  2. Name it Cost Per Order Per Engineering Team and choose a folder.
  3. On the empty Dashboard, select Add > Visualization.
  4. Select CloudZero Billing Data as the data source.
  5. Select these fields:
    • Cost Types & Usage > Real Cost
    • Custom Dimensions > Engineering Team
    • Unit Metrics > Engineering Team Orders
Selected fields for the visualization

Step 3: Add the cost-per-order calculation

You now have your spend and your unit metric in the same table. The calculation that turns them into a unit cost is spend / unit metric.

  1. Select Add calculation.

  2. In the Expression field, enter:

    ${base_billing_data.real_cost}/${engineering_team_orders_<id>_unit_metric.metric}

    The <id> is filled in automatically when you select your stream from the autocomplete drop-down. Stream names use underscores in the expression even if they were created with hyphens.

  3. Set Format to U.S. Dollars and Decimals to 2.

  4. Name the calculation Cost Per Order.

  5. Select Save.

The custom expression for the calculation

Step 4: Visualize and save

Now turn the table into a chart that's easy to scan.

  1. In the Visualization bar, select the column chart icon.
  2. Hide the raw Real Cost and Engineering Team Orders columns: click the cog icon next to each, then Hide this field in visualization. The chart now shows only the cost per order, broken down by team.
  3. Select Save on the tile, then Save on the Dashboard.
Finished cost per order per engineering team chart

That's it. Your Dashboard now shows what each engineering team's customer orders cost you, updated as new data flows in.

Next steps

  • Add another tile. Build one showing total orders over time, or cost per order by day instead of by team.
  • Switch to the API. Once your data source can push directly, send unit metric data through the API instead of uploading CSVs.
  • Layer on another Dimension. Try cost per order per product or per environment to see efficiency at a finer grain.
  • Reuse the unit metric. Once ingested, it's available across Analytics Dashboards and AI Hub queries. Build more visualizations, or just ask "what was our cost per order last week?" in plain English.
  • Share it. Schedule recurring delivery to your team via email, Slack, S3, or webhook. See Scheduled Dashboard delivery.
ℹ️

Have questions or feedback? Reach out to your account manager.