In global supply chain management, freight invoice inaccuraciesβsuch as duplicate billing, weight overcharges, and unjustified detention feesβaccount for an estimated 5% to 7% of unnecessary logistics expenditure.
This repository presents an enterprise-grade Automated Freight Audit & Analytics System built using Google BigQuery and Power BI. The project adopts the Six Sigma DMAIC (Define, Measure, Analyze, Improve, Control) methodology to systematically uncover cost leakage, streamline auditing workflows, and establish continuous data control.
ββββββββββββ βββββββββββ ββββββββββββ ββββββββββββ βββββββββββ
β DEFINE β βββΊ β MEASURE β βββΊ β ANALYZE β βββΊ β IMPROVE β βββΊ β CONTROL β
ββββββββββββ βββββββββββ ββββββββββββ ββββββββββββ βββββββββββ
Problem & Data Pipeline Audit Marts & Power BI Dash Automated
Objectives Architecture Root Cause Visualizations Data Rules
Problem Statement
The logistics organization faces financial loss due to unverified carrier invoices. Manual sampling fails to catch duplicate invoices, discrepancies between Warehouse Management System (WMS) weight logs and carrier-billed weights, and improper demurrage/detention penalty assessments during contractual free time.
Business Objectives
- Automate 100% Invoice Audit: Eliminate manual sample checks by transforming raw logistics streams into auto-audited data marts.
- Recover Overcharged Capital: Identify invalid billings (duplicate charges, carrier-induced SLA delays, improper storage fees) to submit financial claims.
- Optimize Payload Capacity: Track container load factors to reduce underutilization.
Target Stakeholders
- Logistics & Supply Chain Directors: High-level cost transparency, vendor compliance ratings, and total claimable financial recovery.
- Freight Audit & Billing Specialists: Operational granularity down to individual Bill of Lading (BOL) level for invoice dispute processing.
Data Pipeline Architecture The solution uses Google BigQuery as a scalable cloud data warehouse to process raw operational logs and contract matrices into structured audit layers.
[Raw Data Ingestion]
βββ raw_carrier_invoices (Carrier billing streams)
βββ fact_shipments_bol (WMS & logistics execution logs)
βββ dim_contract_rates (Agreed contract rates & Free Time terms)
βββ dim_exchange_rates (Currency conversion benchmarks)
β
βΌ
[BigQuery Staging Layer] -> v_stg_invoices
βββ FX Normalization (to USD) & Multi-attribute Deduplication
β
βΌ
[BigQuery Core Audit Layer] -> v_base_freight_audit
βββ Relational JOINs across Invoices, BOL execution, and Contracts
β
βΌ
[BigQuery Data Marts Layer] -> 5 Domain-Specific Views
βββ v_mart_sla_violation_audit
βββ v_mart_weight_discrepancy
βββ v_mart_demurrage_detention
βββ v_mart_underutilization
βββ v_mart_booking_no_show_detention
β
βΌ
[Power BI Analytical Presentation Layer]
βββ Star-schema Data Model with custom DAX measures & 4:3 ratio canvases
Core Metrics & Key Performance Indicators (KPIs)
| Metric Category | Measure Name | Formula / Logic | Business Target |
|---|---|---|---|
| Integrity | M_Total_Duplicate_Amount_USD |
$$0$ (Zero duplicates paid) | |
| Integrity | M_Claimable_SLA_Amount_USD |
100% Claim recovery | |
| Weight Audit | M_Overbilled_Weight_KG |
|
|
| Weight Audit | M_Overbilled_Weight_Pct |
|
|
| Storage Audit | M_Invalid_Storage_Fees_USD |
$$0$ invalid penalties | |
| Utilization | M_Avg_Capacity_Utilization_Pct |
|
The system partitions analytics into five specialized business dashboards formatted for standard 4:3 canvas layouts.
1. Invoice Integrity & SLA Claim Audit
- Business Purpose: Detect duplicate invoice submissions and identify carrier-caused delivery SLA violations for claim generation.
- Key Visuals: KPI Cards (Duplicate Count, Duplicate USD, Claimable SLA Amount), Column Chart of Billing by Audit Flag, SLA Delay Root Cause Donut Chart, Detailed BOL Dispute Table.
- Dashboard Preview:
2. Weight Discrepancy & Billing Audit
- Business Purpose: Benchmark carrier billed weight against WMS scale measurements to uncover over-billing.
- Key Visuals: Weight Comparison KPIs (Billed vs. WMS), Top Over-billing Carriers Bar Chart, Discrepancy % by Container Type Scatter Plot, Line-item Weight Audit Table.
- Dashboard Preview:
3. Demurrage & Detention Charge Audit
- Business Purpose: Audit carrier demurrage and detention assessments against contractual free-time allowances.
- Key Visuals: Storage Penalty KPIs, Actual Port Stay vs. Contractual Free Days Clustered Column Chart, Invalid Penalty Status Distribution, Storage Fee Detail Grid.
- Dashboard Preview:
4. Container Weight Utilization Efficiency
-
Business Purpose: Identify underutilized container capacity (
$<60%$ payload) to reduce total shipment volume requirements. - Key Visuals: Average Load Factor Gauge Chart, Utilization Breakdown by Container Type (20DC vs 40HC), Underutilized Shipment Ratio Cards, Container Payload Detail Table.
- Dashboard Preview:
5. Carrier & Route Detention Performance
- Business Purpose: Measure container turnaround times and total detention costs across carriers and shipping corridors (Trade Lanes).
-
Key Visuals: Trade Lane Heatmap Matrix (POL_Origin
$\times$ POD_Destination), Average Detention Days by Carrier, Total Shipment Volume Cards, Route Level Performance Breakdown. - Dashboard Preview:
Based on data mart analysis, the following operational improvements are implemented:
ββββββββββββββββββββββββββββββββββββββββββββββββ
β ACTIONABLE IMPROVEMENTS β
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Automated Claim β β Contract Term β β Load Factor β
β Generation β β Negotiations β β Consolidation β
βββββββββββββββββββ€ βββββββββββββββββββ€ βββββββββββββββββββ€
β Export detail β β Leverage carrierβ β Consolidate LCL β
β dispute logs β β scorecards usingβ β shipments on β
β directly into β β detention & SLA β β routes with β
β Carrier Claim β β data to extend β β load factors β
β templates. β β Free Time. β β under 60%. β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
To ensure long-term data integrity and prevent regression, control mechanisms are applied at both warehouse and BI layers.
Data Warehouse Controls (Google BigQuery)
- Ingestion Deduplication Logic: Uses window functions (
ROW_NUMBER() OVER(PARTITION BY BOL_Number, Billed_Total_Amount)) inv_stg_invoicesto flag duplicates upon ingestion. - Partition Filter Optimization: Explicitly handles ingestion-time partitioning filters (_PARTITIONDATE) across staging views to guarantee low-latency query performance and maintain schema stability.
Power BI Data Model Controls
- Star Schema Design: All 5 data marts connect to a centralized, calculated calendar table (dim_date_table), enforcing date aggregation consistency across all visuals.
- Isolated DAX Measures Layer: DAX measures are defined against model views rather than raw tables, enabling dynamic filtering based on user role and date context.
Freight_Audit_Project/
βββ assets/
β βββ images/
β β βββ Carrier & Route Detention Performance.png
β β βββ Container Weight Utilization Efficiency.png
β β βββ Demurrage & Detention Charge Audit.png
β β βββ Invoice Integrity & SLA Claim Audit.png
β β βββ Weight Discrepancy & Billing Audit.png
β βββ architecture_diagram.png
βββ data/
β βββ raw/
β β βββ dim_contract_rates.csv
β β βββ dim_exchange_rates.csv
β β βββ fact_shipments_bol.csv
β β βββ raw_carrier_invoices.csv
β βββ data-dictionary/
β βββ data-dictionary.xlsx
βββ docs/
β βββ Executive_Summary.md
β βββ Business_Requirements.md
βββ reports/
β βββ freight-audit-2-2.pbix
β βββ freight-audit-2-2.pbit
βββ src/
β βββ dax/
β β βββ dim_date_table.dax
β β βββ measures.dax
β βββ json/
β β βββ Logistics_Freight_Audit_Theme.json
β βββ python/
β β βββ generate_mock_data.py
β βββ sql/
β βββ 01_stg/
β β βββ v_stg_invoices.sql
β βββ 02_core/
β β βββ v_base_freight_audit.sql
β βββ 03_marts/
β βββ v_mart_booking_no_show_detention.sql
β βββ v_mart_demurrage_detention.sql
β βββ v_mart_sla_violation_audit.sql
β βββ v_mart_underutilization.sql
β βββ v_mart_weight_discrepancy.sql
βββ .gitignore
βββ LICENSE
βββ README.md
1. Clone the Repository:
git clone https://github.com/tritaptheduc/Freight_Audit_Project.git
cd Freight_Audit_Project2. Load Raw Data to Google BigQuery:
- Create dataset
freight_audit_db_2inside projectfreight-audit-project. - Upload the 4 CSV files from the
data/directory into BigQuery.
3. Execute SQL Transformations:
Run the SQL scripts in src/sql/ in the following sequence:
v_stg_invoices.sqlv_base_freight_audit.sqlv_mart_*.sql(all analytical data marts)
4. Launch Power BI Dashboard:
- Open
reports/freight-audit-2-2.pbitin Power BI Desktop. - Provide your BigQuery GCP Project ID and Dataset ID when prompted.
Apply the custom theme from src/json/Logistics_Freight_Audit_Theme.json if required.




