MicroStrategy ONE

Modulus

Returns the remainder of a number when divided by a another number. The result has the same sign as the dividend. This is a single-value function.

Syntax

Mod (Argument, Divisor)

Where:

Argument is a metric representing a list of real numbers.

Divisor is the number used to divide the value(s) of Argument.

Usage Notes

The function returns a NULL if Divisor = 0.

Use the Quotient function to return only the integral part of the result.

Example

These simple examples illustrate the results of using the Mod function.

Function/Result Calculation

Mod(5, 2) = 1

5/2 = 2 remainder 1

Mod(5, -2) = 1

5/-2 = 2 remainder 1 and takes the sign of the dividend

Mod(-5, 2) = -1

-5/2 = 2 remainder 1 and takes the sign of the dividend

Mod(140, 2) = 0

140/2 = 70 remainder 0

Mod(83, 9) = 2

83/9 = 9 remainder 2

Mod(-5, -2) = -1

-5/-2 = 2 remainder 1 and takes the sign of the dividend