Arithmetic functions

Arithmetic functions are used to perform basic calculations on values in Profile Query Language (PQL). More information about other PQL functions can be found in the Profile Query Language overview.

Add

The + (addition) function is used to find the sum of two argument expressions as a number.

Format

{NUMBER} + {NUMBER}

Example

The following PQL query sums the price of two different products.

product1.price + product2.price

Multiply

The * (multiplication) function is used to find the product of two argument expressions as a number.

Format

{NUMBER} * {NUMBER}

Example

The following PQL query finds the product of the inventory and the price of a product to find the gross value of the product.

product.inventory * product.price

Subtract

The - (subtraction) function is used to find the difference of two argument expressions as a number.

Format

{NUMBER} - {NUMBER}

Example

The following PQL query finds the difference in price between two different products.

product1.price - product2.price

Divide

The / (division) function is used to find the quotient of two argument expressions as a number.

Format

{NUMBER} / {NUMBER}

Example

The following PQL query finds the quotient between the total products sold and total money earned to see the average cost per item.

totalProduct.price / totalProduct.sold

Remainder

The % (modulo/remainder) function is used to find the remainder after dividing the two argument expressions as a number.

Format

{NUMBER} % {NUMBER}

Example

The following PQL query checks if the person’s age is divisible by five.

person.age % 5 = 0

Next steps

Now that you have learned about arithmetic functions, you can use them within your PQL queries. For more information about other PQL functions, please read the Profile Query Language overview.

recommendation-more-help
770bc05d-534a-48a7-9f07-017ec1e14871