Number.BitwiseOr

Number

Performs a bitwise OR operation on two integer values.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Number.BitwiseOr(number1 as number, number2 as number) as number

Parameters

NameTypeRequiredDescription
number1numberYesThe first integer operand.
number2numberYesThe second integer operand.

Return Value

numberAn integer where each bit is 1 if the corresponding bit is 1 in either input.

Remarks

Number.BitwiseOr performs a bitwise OR between two integers. Each bit position in the result is 1 when the corresponding bit is 1 in at least one of the operands; it is 0 only when both operands have 0 at that position. Both inputs are treated as integers — fractional parts are truncated.

Bitwise OR is most commonly used to set bits (turn specific bits on) or merge bitmasks. Unlike AND (which tests/extracts bits), OR ensures that bits are added to a value. A value ORed with a mask will always have at least the mask's bits set.

Common patterns:

- Combine flags: Number.BitwiseOr(flags, 4) sets bit 2 in flags regardless of its current state - Merge permission sets: OR-ing two permission integers gives the union of all permitted capabilities - Reconstruct packed values: building an integer from separate bit-field contributions by OR-ing shifted components

Note that Number.BitwiseOr(x, x) = x (idempotent) and Number.BitwiseOr(x, 0) = x (OR with 0 is identity).

Examples

Example 1: Basic bitwise OR

Result
Result
114

Example 2: Set bit 0 (value 1) in a number that doesn't have it

Result
Result
113

Example 3: Combine permission flags (Read=1, Write=2, Execute=4)

let
    Read = 1,
    Write = 2,
    Execute = 4,
    ReadWrite = Number.BitwiseOr(Read, Write),
    AllPerms = Number.BitwiseOr(ReadWrite, Execute)
in
    #table({"ReadWrite", "AllPerms"}, {{ReadWrite, AllPerms}})
Applied Steps

The final output — a single-row table showing ReadWrite = 3 and AllPerms = 7.

ReadWrite
AllPerms
137

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks