Less-Than-Truckload Costing Utility

Overview

The Less Than Truckload Costing utility solves the challenge of pricing less-than-truckload (LTL) shipments when carrier rate data is complex and varies by service level, distance, and weight. Rather than manually looking up rates in carrier tariff tables, this workflow automates the entire process using FedEx Express Freight standard list rates. The utility expects a lanes-to-cost table containing shipment details including origin, destination, distance, weight, and desired service level. After running the utility, users receive a fully costed table with calculated transportation costs.

The Less Than Truckload Costing Utility is available on the Resource Library, from which you can download it or copy it to your Optilogic account. Learn more about the Resource Library in this How to use the Resource Library help center article.

What's Included

Sample Data

  • Sample lanes_to_cost CSV file (5,000 lanes across the US)

System Utility

  • Less Than Truckload Costing utility accessible via the "Run AI Agent" task in DataStar
  • Built-in FedEx Express Freight rate tables (automatically loaded by the utility)

How To Use

The steps to use this utility are as follows. These are illustrated with screenshots below.

  1. Prepare your input data:
    • Create a lanes_to_cost table with all required columns (see Input Requirements)
    • Ensure distances are calculated in miles
    • Assign appropriate service levels to each shipment
    • Set the destination_rural flag correctly for Alaska/Hawaii destinations, see also the Tups & Notes section
  2. Upload your data to a database in DataStar
    • Upload the file to your Optilogic account
    • Create a data connection to it in DataStar
    • Import the data into the project sandbox by using an Import task
  3. Run the utility:
    • Open the "Run AI Agent" task in DataStar
    • Select "Less Than Truckload Costing" from the available utilities
    • Configure the parameters:
      • Database: Enter your database name
      • Schema: Select the schema containing your table
      • Lanes Table: Select your lanes_to_cost table
      • Output Table: Specify the output table name
      • Keep Working Tables: Toggle on to retain intermediate tables for debugging
      • Verbose: Toggle on for detailed logging
  4. Review the output table containing costed lanes

Screenshots of the steps:

The first 10 records of the ltl_lanes_ to_cost.csv.
This macro is available in the Less-Than_Truckload Costing Demo project copied from the Resource Library. All tasks are configured and ready to go: the "Import ltl_lanes_to_cost" Import task imports the data from the CSV data connection into the Project Sandbox with table name "ltl_lanes_to_cost", the "Update datatype" Run SQL task changes the data type of the Cost column, and the "Run AI Agent" Run AI Agent task looks up the less-than-truckload freight costs and adds them to the data in a new output table named "ltl_lanes_to_cost_output". The configuration of this Run AI Agent task is shown in the next 2 screenshots. If you are using your own lanes to cost file, you will need to update the Import task to point it to your own data as the source data, and possibly update the Run SQL task.
The Select Utility section of the configuration of the Run AI Agent task where Less-Than-Truckload Costing is chosen from the list of Utilities.
Configuration of the "Less-Than-Truckload Costing" Run AI Agent task. The Database is the Project Sandbox of the DataStar project, the ltl_lanes_to_cost table is used as the input table for which less-than-truckload rates need to be looked up, the output table is left at the default and will therefore be named ltl_lanes_to_cost_output. The user has chosen to not keep working tables (appended with _working) and to see detailed outputs in the Task Logs tab when this task is executed. Note that in the Run Configuration section the Resource Size is changed from 3XS to S, which is recommended when running this costing utility.
In the Project Sandbox, the ltl_lanes_to_cost table contains the imported data from the CSV connection, and the ltl_lanes_to_cost_output table contains the original data with the looked up costs added after running the macro.
Ten of the 5,000 records in the ltl_lanes_to_cost_output table, where we see the populated cost, cost_type, and costing_method columns.

Input Requirements

Lanes to Cost Table (Required)

Key Constraints:

  • No NULL values allowed in any required column
  • Service level values must be lowercase and match exactly: "economy" or "priority"
  • Freight class must be a valid NMFC class value (see Supported Freight Classes below)
  • Weights must be positive numbers in pounds
  • Postal codes must be exactly 5 digits
  • Zones must be integers between 101 and 150 (inclusive)

Output Description

The utility produces an output table containing all lanes from the input with the following additional columns populated:

Cost Calculation

LTL costs are calculated as a three-component sum:

  • cost = line_haul charge + origin_ accessorial_ charge + destination_accessorial_ charge

Each component is calculated independently using the formula:

  • component_charge = MAX(rate_ per_ 100lbs x (weight_ lbs / 100), minimum_ charge)

Where:

  • Line-Haul Charge: Determined by service level, freight class, zone, and weight band from the FedEx zone-based rate table
  • Origin Accessorial Charge: Determined by service level, freight class, the origin pickup tier (derived automatically from the origin postal code), and weight band.
  • Destination Accessorial Charge: Determined by service level, freight class, the destination delivery tier (derived automatically from the destination postal code), and weight band.
  • Pickup/Delivery Tiers: The utility automatically looks up origin and destination tiers (A through I) using the postal codes provided. You do not need to supply tiers in your input data.

Zone Reference

FedEx Freight zones (101–150) represent the transit distance and pricing tier between an origin and destination. Zones are assigned by FedEx based on origin and destination ZIP codes. You can determine the correct zone for a lane using the FedEx Freight zone chart or a zone lookup tool.

Higher zone numbers generally correspond to longer distances and higher rates.

Supported Freight Classes

The utility supports the following standard NMFC freight classes:

Freight class values are case-insensitive and will be normalized automatically. Common formats such as "60", "60.0", and "60.00" are all accepted and treated as equivalent.

Service Levels

Service level values are normalized to lowercase automatically, so "Economy", "ECONOMY", and "economy" are all accepted.

Failure Reasons

If a lane cannot be costed, the failure_reasons column will contain one or more of the following:

Tips & Notes

  • The workflow is fully deterministic - given the same inputs, it will always produce the same outputs.
  • Original input tables are never modified. The utility creates working copies for all processing.
  • The FedEx rate tables are built into the utility and are automatically loaded. You do not need to provide rate data.
  • Freight zones (101–150) must be determined prior to running the utility. These can be looked up using a FedEx Freight zone chart based on origin and destination ZIP codes.
  • Origin and destination pickup/delivery tiers are derived automatically from postal codes. You do not need to supply tier information in your input data.
  • Lanes with a non-empty failure_reasons column were not costed. Review the failure reasons to identify and fix data quality issues before re-running.
  • Freight class values are normalized automatically. You do not need to ensure a specific format (e.g., "60" and "60.0" are treated identically).
  • Service level values are normalized to lowercase automatically, so mixed-case input is accepted.
  • This utility currently supports US domestic less-than-truckload shipments only.

Other Helpful Resources

Overview

The Less Than Truckload Costing utility solves the challenge of pricing less-than-truckload (LTL) shipments when carrier rate data is complex and varies by service level, distance, and weight. Rather than manually looking up rates in carrier tariff tables, this workflow automates the entire process using FedEx Express Freight standard list rates. The utility expects a lanes-to-cost table containing shipment details including origin, destination, distance, weight, and desired service level. After running the utility, users receive a fully costed table with calculated transportation costs.

The Less Than Truckload Costing Utility is available on the Resource Library, from which you can download it or copy it to your Optilogic account. Learn more about the Resource Library in this How to use the Resource Library help center article.

What's Included

Sample Data

  • Sample lanes_to_cost CSV file (5,000 lanes across the US)

System Utility

  • Less Than Truckload Costing utility accessible via the "Run AI Agent" task in DataStar
  • Built-in FedEx Express Freight rate tables (automatically loaded by the utility)

How To Use

The steps to use this utility are as follows. These are illustrated with screenshots below.

  1. Prepare your input data:
    • Create a lanes_to_cost table with all required columns (see Input Requirements)
    • Ensure distances are calculated in miles
    • Assign appropriate service levels to each shipment
    • Set the destination_rural flag correctly for Alaska/Hawaii destinations, see also the Tups & Notes section
  2. Upload your data to a database in DataStar
    • Upload the file to your Optilogic account
    • Create a data connection to it in DataStar
    • Import the data into the project sandbox by using an Import task
  3. Run the utility:
    • Open the "Run AI Agent" task in DataStar
    • Select "Less Than Truckload Costing" from the available utilities
    • Configure the parameters:
      • Database: Enter your database name
      • Schema: Select the schema containing your table
      • Lanes Table: Select your lanes_to_cost table
      • Output Table: Specify the output table name
      • Keep Working Tables: Toggle on to retain intermediate tables for debugging
      • Verbose: Toggle on for detailed logging
  4. Review the output table containing costed lanes

Screenshots of the steps:

The first 10 records of the ltl_lanes_ to_cost.csv.
This macro is available in the Less-Than_Truckload Costing Demo project copied from the Resource Library. All tasks are configured and ready to go: the "Import ltl_lanes_to_cost" Import task imports the data from the CSV data connection into the Project Sandbox with table name "ltl_lanes_to_cost", the "Update datatype" Run SQL task changes the data type of the Cost column, and the "Run AI Agent" Run AI Agent task looks up the less-than-truckload freight costs and adds them to the data in a new output table named "ltl_lanes_to_cost_output". The configuration of this Run AI Agent task is shown in the next 2 screenshots. If you are using your own lanes to cost file, you will need to update the Import task to point it to your own data as the source data, and possibly update the Run SQL task.
The Select Utility section of the configuration of the Run AI Agent task where Less-Than-Truckload Costing is chosen from the list of Utilities.
Configuration of the "Less-Than-Truckload Costing" Run AI Agent task. The Database is the Project Sandbox of the DataStar project, the ltl_lanes_to_cost table is used as the input table for which less-than-truckload rates need to be looked up, the output table is left at the default and will therefore be named ltl_lanes_to_cost_output. The user has chosen to not keep working tables (appended with _working) and to see detailed outputs in the Task Logs tab when this task is executed. Note that in the Run Configuration section the Resource Size is changed from 3XS to S, which is recommended when running this costing utility.
In the Project Sandbox, the ltl_lanes_to_cost table contains the imported data from the CSV connection, and the ltl_lanes_to_cost_output table contains the original data with the looked up costs added after running the macro.
Ten of the 5,000 records in the ltl_lanes_to_cost_output table, where we see the populated cost, cost_type, and costing_method columns.

Input Requirements

Lanes to Cost Table (Required)

Key Constraints:

  • No NULL values allowed in any required column
  • Service level values must be lowercase and match exactly: "economy" or "priority"
  • Freight class must be a valid NMFC class value (see Supported Freight Classes below)
  • Weights must be positive numbers in pounds
  • Postal codes must be exactly 5 digits
  • Zones must be integers between 101 and 150 (inclusive)

Output Description

The utility produces an output table containing all lanes from the input with the following additional columns populated:

Cost Calculation

LTL costs are calculated as a three-component sum:

  • cost = line_haul charge + origin_ accessorial_ charge + destination_accessorial_ charge

Each component is calculated independently using the formula:

  • component_charge = MAX(rate_ per_ 100lbs x (weight_ lbs / 100), minimum_ charge)

Where:

  • Line-Haul Charge: Determined by service level, freight class, zone, and weight band from the FedEx zone-based rate table
  • Origin Accessorial Charge: Determined by service level, freight class, the origin pickup tier (derived automatically from the origin postal code), and weight band.
  • Destination Accessorial Charge: Determined by service level, freight class, the destination delivery tier (derived automatically from the destination postal code), and weight band.
  • Pickup/Delivery Tiers: The utility automatically looks up origin and destination tiers (A through I) using the postal codes provided. You do not need to supply tiers in your input data.

Zone Reference

FedEx Freight zones (101–150) represent the transit distance and pricing tier between an origin and destination. Zones are assigned by FedEx based on origin and destination ZIP codes. You can determine the correct zone for a lane using the FedEx Freight zone chart or a zone lookup tool.

Higher zone numbers generally correspond to longer distances and higher rates.

Supported Freight Classes

The utility supports the following standard NMFC freight classes:

Freight class values are case-insensitive and will be normalized automatically. Common formats such as "60", "60.0", and "60.00" are all accepted and treated as equivalent.

Service Levels

Service level values are normalized to lowercase automatically, so "Economy", "ECONOMY", and "economy" are all accepted.

Failure Reasons

If a lane cannot be costed, the failure_reasons column will contain one or more of the following:

Tips & Notes

  • The workflow is fully deterministic - given the same inputs, it will always produce the same outputs.
  • Original input tables are never modified. The utility creates working copies for all processing.
  • The FedEx rate tables are built into the utility and are automatically loaded. You do not need to provide rate data.
  • Freight zones (101–150) must be determined prior to running the utility. These can be looked up using a FedEx Freight zone chart based on origin and destination ZIP codes.
  • Origin and destination pickup/delivery tiers are derived automatically from postal codes. You do not need to supply tier information in your input data.
  • Lanes with a non-empty failure_reasons column were not costed. Review the failure reasons to identify and fix data quality issues before re-running.
  • Freight class values are normalized automatically. You do not need to ensure a specific format (e.g., "60" and "60.0" are treated identically).
  • Service level values are normalized to lowercase automatically, so mixed-case input is accepted.
  • This utility currently supports US domestic less-than-truckload shipments only.

Other Helpful Resources

Have More Questions?

Contact Support

Get in touch

Contact Sales

Get in touch

Visit Frogger Pond Community

Visit our Community