An operator is used to specify the type of calculation to be performed on the elements in a formula. You can use the default calculation order or change the order using parentheses.
Four types of calculation operators are available: arithmetic operator, comparison operator, logical operator, and string concatenation operator.
You can use the following arithmetic operators in formulas to perform basic mathematical operations such as addition, subtraction, multiplication, and division.
+ (addition operator)
= 3 + 3
6
– (subtraction operator/unary minus operator)
= 3 – 1
2
* (multiplication operator)
= 3 * 3
9
/ (division operator)
= 15/3
5
% (remainder operator)
= 20 % 6
^ (exponentiation operator)
= 3 ^ 2
You can use the following operators to compare two values. When you use these operators to compare two values, the result is a logical value: TRUE or FALSE.
= (equality operator)
Equal to
A1 = B1
> (greater than operator)
Greater than
A1 > B1
< (less than operator)
Less than
A1 < B1
> = (greater than or equal operator)
Greater than or equal to
A1 > = B1
< = (less than or equal operator)
Less than or equal to
A1 < = B1
!= (inequality operator)
Not equal to
A1 != B1
The usage of logical operators is the same as that of the AND and OR functions.
&&
Logical AND, which returns true if both expressions are true.
Sales > = 10 && Number of salespeople > = 2
||
Logical OR, which returns true if one of the expressions is true.
Sales > = 10 || Number of salespeople > = 2
You can use the + operator to concatenate text fields.
For example, you can use the CONCATENATE function to concatenate the text fields Store Style and Store Name. You can also simply use the + operator, as shown in the following figure.
In some cases, the calculation order may affect the returned value of a formula. Therefore, you need to know how to determine the order and how to change the order to obtain the desired result.
If a formula contains multiple operators, the calculation will be performed according to the operator precedence (shown in the following table) in FineBI. If multiple operators in a formula have same level of precedence (for example, a formula contains both a multiplication operator and a division operator), the calculation will be performed according to the following associativity in FineBI.
Precedence
Operator
Definition
Usage
Associativity
1
–
Unary minus operator
–Expression
Right to left
^
Exponentiation operator
Expression ^ Expression
Left to right
3
*
Multiplication operator
Expression * Expression
/
Division operator
Expression/Expression
%
Remainder operator
Expression % Expression
4
+
Addition operator
Expression + Expression
Subtraction operator
Expression – Expression
>
Greater than operator
Expression > Expression
<
Less than operator
Expression < Expression
> =
Greater than or equal operator
Expression > = Expression
< =
Less than or equal operator
Expression < = Expression
=, ==
Equality operator
Expression = Expression
Expression == Expression
!=
Inequality operator
Expression != Expression
7
Logical AND
Expression && Expression
8
Logical OR
Expression || Expression
To change the calculation order, you need to enclose the part that needs to be calculated first in parentheses.
For example, the result of the following formula is 11, because multiplication is calculated before addition. The formula first multiplies 2 by 3, and then adds 1 and 4 to the result.
= 1 + 2 * 3 + 4
However, if you use parentheses to modify the syntax as follows, 1 and 2 will be added together first, and the result (3) will be multiplied by 3. Finally, 4 will be added to the product to get 13.
= (1 + 2) * 3 + 4
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉
Submitted successfully
Network busy