✅ How to Backfill Missing Azure Billing Data in Synapse or Power BI

If you notice gaps in your billing data—due to a failed export, late setup, or other issue—you can backfill missing records to maintain complete and accurate cost reports.


🕵️‍♂️ 1. Identify the Missing Period

Start by determining the exact dates or months where data is missing. Look for:

  • $0 values in your reports on days when usage was expected
  • Gaps in folder structures in your storage (e.g., missing daily/monthly files)
  • Missing months from your Power BI visuals or Synapse tables

📤 2. Retrieve the Missing Data

💼 A. Use the Azure Portal: “Export Selected Dates”

  1. Go to Cost Management + Billing > Exports.
  2. Select your export > click Export selected dates.
  3. Choose the missing month or date range.
    • If only a few days are missing, export the full month and filter later.
  4. Download or collect the files from your Storage Account.

🧰 B. Use the Cost Management Query API

Use this if:

  • You need partial days
  • The data is older than 13 months

Steps:

  1. Call the Cost Management Query API with a date filter.
  2. Save the usage details to CSV or JSON.
  3. Scriptable via PowerShell, Python, or REST clients.

📥 C. Manual Download via Cost Analysis

For small backfills:

  1. Go to Cost Management > Cost Analysis.
  2. Set a custom date range and export the usage data to CSV.
  3. Select Daily granularity for per-day records.

🔄 3. Load Backfilled Data into Synapse or Power BI

In Synapse:

  • SQL Table: Use a Synapse pipeline to append CSV data into your cost table.
  • External Tables: Place the file in the expected directory. If your external table uses a wildcard path, it will pick it up automatically.
  • Spark: Use a notebook to read the backfill file and write into your target table or data lake.

In Power BI:

  • If using a folder-based query:
    • Drop the CSV into the same folder as your other exports.
    • Power BI will ingest it on next refresh.
  • If using a fixed-file query:
    • Add a new query for the backfill file.
    • Append that query to your main cost table in Power Query.
  • For very small gaps:
    • You can manually paste the data into Power BI Desktop (not recommended for large datasets).

✅ 4. Verify and Reconcile

After loading the data:

  • Recalculate totals for the affected period.
  • Compare with Azure Cost Analysis in the portal to confirm accuracy.
  • Use filters or DISTINCT to avoid duplicates if overlapping files were loaded.

🔁 5. Prevent Future Gaps

ProblemPrevention
Export failureSet up alerts with Azure Monitor or Logic Apps to detect when files are missing
Subscription disabledEnsure billing is enabled (see [Guide #1])
Misconfigured exportConfirm export is enabled, scheduled, and writing to the correct path

Keep your export schedule monitored and document your backfill process for future reference.


🧪 Example

You notice your April 15 data is blank.
→ Go to Cost Analysis, export April 15 as a CSV.
→ Add it to your cost folder used by Power BI.
→ Refresh the dataset—April 15 now reflects the correct cost.


🎯 Result: A complete and accurate cost dataset, filling any historical gaps that could otherwise skew trendlines, forecasting, or budgeting.