Newer Version Available
Arithmetic Operators
Use arithmetic operators to perform addition, subtraction, multiplication, division, and
modulo operations.
| Operator | Description |
|---|---|
| + | Plus |
| - | Minus |
| * | Multiplication |
| / | Division |
| % | Modulo |
Example
You want to charge each of your accounts 5% of their opportunities as a fee. Create a query that multiplies the Amount field by .05. This query will resemble the following:
1q = load "opportunity";
2q = group q by 'Account.Name';
3q = foreach q generate 'Account.Name' as 'Account.Name', sum('Amount') * 0.05 as 'Fee';
4q = order q by 'Fee' desc;
5q = limit q 2000;