BITRSHIFT
A whole number's bits shifted right by a number of places.
Group: Math. Compatible with DAX.
Syntax
BITRSHIFT ( <Number>, <Shift_Amount> )
| Parameter | Type | Description |
|---|---|---|
Number | Whole number | The number whose bits move. |
Shift_Amount | Whole number | How 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 andBITRSHIFT ( 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 2 | 7 by 1 | -16 by 2 | 5 by -2 |
|---|---|---|---|
| 4 | 3 | -4 | 20 |