Number.BitwiseAnd

Number

Performs a bitwise AND 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.BitwiseAnd(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 only if the corresponding bit is 1 in both inputs.

Remarks

Number.BitwiseAnd performs a bitwise AND between two integers. Each bit position in the result is 1 only when the corresponding bit is 1 in both operands; otherwise it is 0. Both inputs are treated as integers — any fractional part is truncated before the operation.

The most common use of bitwise AND is bit masking: extracting or testing specific bits within a packed integer value. Practical scenarios in Power Query include:

- Flag testing: checking whether a specific capability or status bit is set in an integer flags column (e.g., Number.BitwiseAnd(flags, 4) > 0 tests bit 2) - Permission bitmasks: determining whether a user's permission integer includes a specific right - Extracting byte fields: isolating the lower N bits of a packed value using a mask like 15 (0xF, lower 4 bits) or 255 (0xFF, lower 8 bits)

Note that bitwise operations in Power Query M are 64-bit integer operations. Values are cast to 64-bit signed integers before the operation, which can produce unexpected results if you pass large floating-point numbers.

Examples

Example 1: Basic bitwise AND

Result
Result
18

Example 2: Test whether bit 2 (value 4) is set in a flags integer

Result
Result
1TRUE

Example 3: Extract the lower 4 bits (nibble) using mask 15 (0xF)

Result
Result
15

Compatibility

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