Overview: In this tutorial you will learn and understand what is MOD function in SAP analytics Cloud and how you can use MOD function in different situation.
MOD() Function
Mod function in SAP Analytics Cloud is used to return the remainder of number dividing by a another number. The first number in Mod function is the divided number (numerator) <number1> and dividing by second number (denominator) <number2>.
Mod returns the remainder of a number <number> divided by a divisor <divisor> .
Purpose: Return remainder from division
Syntax:
MOD( Number1, Number2 )
Below list shows, how the MOD function returns as the result:
- If <divisor> is zero, then <number> is returned.
- If <divisor> is NULL, then error will returned.
Arguments:
number – The number to be divided.
divisor – The number to divide with.
Lets take examples to understand it more
Example #1: MOD() for constant value
This is simple example to understand how MOD look like and how you can pass the number in MOD() functions
with example
MOD( 25, 2)
IN this it will return the value 1, as dividing 25 with 2 will return the remainder = 1
Example #2: MOD for measure column
Now lets example for dataset in Sap analytics cloud for measure column,
Suppose you want to know the remainder of total cost divided by Unit cost, then you can use MOD() function as third column which will show the remainder of this division
Formula:
MOD( Total cost, Unit cost)
The output will be look like this. you can also use MOD function for graph view (like combined chart and time series chart)
MOD() function can be use for different source of data which is really helpful to understand total division between two numbers, which we need some time in mathematical calculation.