Swallow
  • YOUR FIRST MODEL
    • Setting up your first project
    • Manual setup of a new product
    • Excel Model Upload
    • Create your team
    • Essential concepts
      • Syntax
      • Steps
      • Collections
      • Try Model
      • Spotlight
  • PROCESS
    • Team Management
    • Governance & Collaboration
  • BUILD
    • Building with AI
    • Step builder
      • Understanding step types
      • Ordering step blocks
      • Placeholder mode
      • Up/Downloading models
      • Sharing your model
      • Running tests
    • Inputs
    • Enriching Raw Data
      • Transform Data
      • Enrich via API
      • Data Set
      • Collection
      • Custom Code
    • Setting Up Decisions
      • Exclusions
      • Excesses
      • Endorsements
      • Refer
    • Making Calculations
      • Factors
      • Calculation
    • Outputs
  • TEST
    • Creating New Tests
    • Running Tests
    • Editing Tests
    • Reading & Interpreting Tests
    • Impact Testing
  • DATA
    • Working with real-time data
    • Data Views
    • Data Quotas
    • Troubleshooting
    • API Webhooks
    • Data Downloads
  • ADMIN & SETTINGS
    • Project Management
    • Account Management
  • INTEGRATIONS
    • Introduction
    • Payments
      • Stripe
      • GoCardless
      • Adyen
    • Alerting
      • Slack
      • Zapier
    • Data
      • AWS S3
      • Google Sheets
    • Admin
      • Socotra
      • Guidewire
      • Hubspot
      • Salesforce
  • Developer API
    • Introduction
    • Authentication
    • Errors codes
    • Endpoints
      • /quotes
      • /projects
      • /tests
      • /process
Powered by GitBook
On this page
  • 1. Write your calculation
  • Output Key
  • Formula
  • Default Value
  • 2. Save the step
  1. BUILD
  2. Making Calculations

Calculation

Using the 'Calculation' step in the builder to define complex calculations

PreviousFactorsNextOutputs

Last updated 1 year ago

Define complex calculations you can use for final prices or rates based on the inputs in the rest of your model.

How might you use the 'Calculation' step?

If you've creating a pricing model for insurance, you'll need to calculate premiums as well as a variety of rates and commissions.

1. Write your calculation

To get started, click the cog symbol in the top right of the 'Calculation' step.

There are three fields to complete for this step.

Output Key

This will be the key that you will use in all subsequent expressions and calculations, including in the final 'Output' step of your model, so it will need to be unique, descriptive, and easy to understand.

You can use letters, symbols and numbers, but no spaces.

Formula

This is the formula for your final calculation.

Here's an example of how you would structure an formula multiplying your base price against your vehicle peril risk factor and driver peril risk factor, rounding the result:

round({{driver_peril}} * {{vehicle_peril}} * {{base}}, 4)

To learn how to structure your expression in more detail and to see the full list, check out our full page on Syntax. Here you can learn how to structure your expression in more detail, debug and see a full glossary.

Default Value

This is the default value you want to set for the calculation.

This is the data the model will default to should any values not return as expected.

2. Save the step

Once you're happy with your calculation, just press the 'Save' button in the top right of the screen. You're now ready to head back to the 'Build' screen.

Once you've added the 'Calculation' step and named it, like you will with any other step in the Build tool (), you'll need to write your calculation.

more on that here
The Calculation step
Save step button