✅ How to Merge Historical and New Cost Export Data in Azure

Azure Cost Management exports only include data from the time they’re created forward. To analyze trends across multiple years, you’ll need to backfill historical data and merge it with your ongoing exports for reporting.


🕰️ 1. Export Historical Cost Data

📅 Option A: Use “Export Selected Dates” in the Portal

  1. Go to Cost Management + Billing > Exports in the Azure Portal.
  2. Select your export or create a new one-time export.
  3. Choose Export selected dates and pick a date range (up to one month per run).
  4. Repeat for each month you want to backfill (up to 13 months total).

✅ Result: Historical files will appear in the same container as your daily export, with folders like 20230101-20230131/.


💻 Option B: Use the Exports REST API (for more than 13 months)

  1. Use the Cost Management Exports API to define one-time exports for older periods.
  2. Specify the desired timePeriod in each API call.
  3. Run exports in monthly chunks to stay organized.
  4. Once complete, delete these one-time exports if they’re no longer needed.

🗂️ 2. Organize the Files in Storage

  1. Keep historical and ongoing exports in the same container and consistent folder structure.
    • Example:
      • cost-exports/20230101-20230131/RunID/usage.csv
      • cost-exports/20250701-20250731/RunID/usage.csv
  2. If needed, move or rename folders to ensure easy wildcard access during analysis.

🔄 3. Merge the Data in Power BI or Synapse

📈 In Power BI:

  1. Connect using the Folder connector.
  2. Power BI will auto-detect all files and combine them if the schema matches.
  3. Use Power Query to:
    • Filter duplicates (e.g., overlapping December exports)
    • Normalize schema if needed

💾 In Azure Synapse:

  1. Create an external table or view using a wildcard path: sqlCopyEditSELECT * FROM OPENROWSET( BULK 'https://<storage-account>.dfs.core.windows.net/<container>/cost-exports/*/usage.csv', FORMAT = 'CSV' ) AS rows
  2. Alternatively, use Synapse Pipelines to copy and append the data into a SQL table.

🧱 4. Normalize the Schema (If Needed)

  • Check for column differences across time:
    • Example: ConsumedService (old EA export) vs ServiceName
    • Tags may appear as flat columns or embedded JSON
  • Add missing columns to historical files or use Power Query to align column names.

✅ Tip: Use the same export format (e.g., Actual Cost CSV) across all exports for consistency.


🧪 5. Example Use Case

You enabled daily exports starting in July 2025 and want full data for 2024 + 2025:

  1. Backfill 2024 with one-time monthly exports.
  2. Let your daily export handle 2025 forward.
  3. In your BI tool, load all files, filter out overlaps (e.g., December 2024), and report on the full range.

📌 Summary

StepAction
📤 ExportUse portal or API to retrieve historical files
🗂️ OrganizeKeep consistent folder paths in Storage
🔀 MergeCombine data using Power BI or Synapse
🧱 NormalizeAlign columns across datasets
📊 AnalyzeBuild year-over-year or trend reports

🎯 Outcome: A unified dataset combining past and present Azure billing data for complete cost visibility.