Introduction
DAX (data analysis expression) language uses a different kind of operator. These operators are symbols that are used to perform arithmetic calculations and logical manipulations.
Below is the list of different types of DAX operators like arithmetic, comparison, text concatenation and logical.
Arithmetic Operators
Arithmetic operations are used to perform mathematical operations such as addition(‘+’), subtraction(‘-‘), multiplication(‘*’), division(‘/’) or exponentiation(‘^’).
Comparison Operators
These operators are used to compare two values. The result of the comparison is a logical value, either TRUE or FALSE.
Operators
|
Meaning
|
=
|
Equal to
|
==
|
Strict equal to
|
<
|
Less than
|
>
|
Greater than
|
>=
|
Greater than or equal to
|
=<
|
Less than or equal to
|
<>
|
Not equal to
|
Concatenation Operator
This operator is used to join or concatenate two string together. Ampersand ‘&’ is used as concatenation operator.
Logical Operator
‘&&’ and ‘||’ are used as logical operators to combine expressions and produce a single result.
Operator
|
Meaning
|
&&
|
AND returns TRUE when both expressions return TRUE
|
||
|
OR returns TRUE
|
IN
|
Creates a logical OR condition between each row being compared to a table
|
Operators and precedence order
In some cases, the order in which calculation is performed can affect the Return value; therefore, it is important to understand how the order is determined and how you can change the order to obtain the desired results.
Calculation Order
An expression assesses the administrators and qualities in a particular request. All expressions consistently start with an equivalent sign (=). The equivalent sign shows that the succeeding characters establish an expression.
Following the equivalent sign are the components to be determined (the operands), which are isolated by count administrators. Articulations are constantly perused from left to right, however the request wherein the components are gathered can be controlled somewhat by utilizing brackets.
Operator Precedence
Below is the list of order of operators according to the precedence value. If they have equal precedence then they are ordered from left to right. Ordering is a must if a formula has many operators.
Operator
|
Description
|
^
|
Exponentiation
|
-
|
Sign (as in -1)
|
*and /
|
Multiplication and Division
|
!
|
NOT (Unary Operator)
|
+ and -
|
Addition and Subtraction
|
&
|
Connnect two string
|
=, ==, <, > , <=, >=, <>
|
Comparision
|
Using parentheses to control calculation order
If you want to change the order of evaluation, you have to enclose the part of calculation in parenthesis that you want to calculate first. For example: - If you calculate 7+4*3 then you will get 19. But in contrast, if you want to add 7 and 4 together then multiple by 3, you have to use parenthesis like (7+4)*3 and you will get 33.
Summary
These are some operators that are used to perform calculations and generate DAX formula. Hope you understand. Thanks for reading. Have a nice day.