Item Rule Numeric Functions and Operators
Use numeric functions and operators to calculate values of numeric expressions.
Numeric Operators
The numeric operators available in item rules are listed below.
-
+ (addition)
-
- (subtraction)
-
* (multiplication)
-
/ (division)
-
sum (aggregation)
Numeric Functions
The numeric functions available in item rules are listed below.
abs
Syntax:
abs (expression)
Returns the absolute value of expression
.
Example:
In this example, the percentage weight change has to be less than 10.
abs(percent([Item].[Physical Attributes].[Unit Weight])) <= 10
ConvertToUOM
Syntax:
ConvertToUOM(expression, "target UOM")
Returns an amount in the specified target UOM
. This conversion ensures that comparisons
or calculations are performed using the appropriate UOM.
Example:
In this example, the unit weight of an item has to be less than or equal to 10 kg.
ConvertToUOM([Item].[Physical Attributes].[Unit Weight], "kg") <= 10
max
Syntax:
max(expression1, expression2, ...)
Returns the maximum value of a series of values. Can also be used for arrays or in query expressions.
Example:
In this example, the result would be 2006-11-30
.
max("2006-10-12", "2006-11-30")
min
Syntax:
min(expression1, expression2, ...)
Returns the minimum value of a series of values. Can also be used for arrays or in query expressions.
Example:
In this example, the result would be 2006-10-12
.
min("2006-10-12", "2006-11-30")
round
Syntax:
round(expression, decimal_places)
Rounds a number to the specified number of decimal
places. round
rounds to the nearest
value.
Example:
In this example, the returned value is 1.58.
round(1.5758, 2)
rounddown
Syntax:
rounddown(expression, decimal_places)
Rounds a number to the specified number of decimal
places. rounddown
rounds toward zero.
Example:
In this example, the returned value is 1.57.
rounddown(1.5758, 2)
roundup
Syntax:
roundup(expression, decimal_places)
Rounds a number to the specified number of decimal
places. roundup
rounds away from zero.
Example:
In this example, the returned value is 1.58.
roundup(1.5758, 2)