DAX function
MOD — DAX function reference
Remainder after division.
Syntax
dax
MOD(<number>, <divisor>)
Examples
dax
MOD([Row], 2)
→ A number
dax
MOD('Date'[WeekOfYear] - 1, 4) + 1→ Groups ISO weeks into 4-week 'periods', a common retail fiscal-calendar pattern
dax
IF(MOD(Sales[InvoiceNumber], 2) = 0, "Even batch", "Odd batch")
→ Splits records into two groups by invoice number parity, e.g. for sampling
Common mistakes & gotchas
- MOD returns a result with the same sign as the divisor, not the dividend, following the floored-division convention — MOD(-7, 3) is 2, not -1, which differs from the % operator in many programming languages.
- MOD(n, 0) returns an error, so guard with DIVIDE-style logic or IFERROR when the divisor could be zero or blank.
Related DAX functions
From Math & statistics