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”
- Go to Cost Management + Billing > Exports.
- Select your export > click Export selected dates.
- Choose the missing month or date range.
- If only a few days are missing, export the full month and filter later.
- 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:
- Call the Cost Management Query API with a date filter.
- Save the usage details to CSV or JSON.
- Scriptable via PowerShell, Python, or REST clients.
📥 C. Manual Download via Cost Analysis
For small backfills:
- Go to Cost Management > Cost Analysis.
- Set a custom date range and export the usage data to CSV.
- 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
Problem | Prevention |
---|---|
Export failure | Set up alerts with Azure Monitor or Logic Apps to detect when files are missing |
Subscription disabled | Ensure billing is enabled (see [Guide #1]) |
Misconfigured export | Confirm 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.