OpenBI Docs Buy

BITRSHIFT

A whole number's bits shifted right by a number of places.

Group: Math. Compatible with DAX.

Syntax

BITRSHIFT ( <Number>, <Shift_Amount> )
ParameterTypeDescription
NumberWhole numberThe number whose bits move.
Shift_AmountWhole numberHow many places they move to the right; a negative amount moves them left.

Returns

Whole number. The number with its bits moved right: each place halves it, the remainder dropped.

Remarks

  • BITRSHIFT ( 16, 2 ) is 4 and BITRSHIFT ( 7, 1 ) is 3.
  • A negative number keeps its sign: BITRSHIFT ( -16, 2 ) is -4.
  • A negative amount moves the bits left: BITRSHIFT ( 5, -2 ) is 20. Keep the amount between -63 and 63.
  • A blank number gives BLANK; a blank amount counts as 0.

Examples

Moving bits to the right

EVALUATE
ROW (
    "16 by 2", BITRSHIFT ( 16, 2 ),
    "7 by 1", BITRSHIFT ( 7, 1 ),
    "-16 by 2", BITRSHIFT ( -16, 2 ),
    "5 by -2", BITRSHIFT ( 5, -2 )
)
16 by 27 by 1-16 by 25 by -2
43-420

BITLSHIFT, BITAND, QUOTIENT.

Last updated · OpenBI Studio 0.3.74