Skip to main content

Arithmetic Operations

HelixQL provides six fundamental arithmetic functions for performing basic mathematical calculations in your queries.

Available Functions

ADD - Addition

SUB - Subtraction

MUL - Multiplication

DIV - Division

POW - Power

MOD - Modulo

When using the SDKs or curling the endpoint, the query name must match what is defined in the queries.hx file exactly.

Example 1: Basic arithmetic in property calculations

Calculate discounted prices and tax for products:
Here’s how to run the query using the SDKs or curl

Example 2: Using POW for exponential calculations

Calculate compound interest over time:
Here’s how to run the query using the SDKs or curl

Example 3: Using MOD for cyclic patterns

Use modulo to determine recurring patterns or groupings:
Here’s how to run the query using the SDKs or curl

Function Composition

Arithmetic functions can be nested to create complex calculations:

Use in Shortest Path Weights

Arithmetic functions are commonly used in custom weight calculations:

Unary Math Functions

SQRT, ABS, LOG, and other single-argument functions

Custom Weight Calculations

Use arithmetic in shortest path weights

Math Overview

Overview of all mathematical functions

Aggregate Functions

MIN, MAX, SUM, AVG for collections