Please note javascript is required for full website functionality.

# Power Pivot Principles: The A to Z of DAX Functions – BITRSHIFT

19 April 2022

In our long-established Power Pivot Principles articles, we continue our series on the A to Z of Data Analysis eXpression (DAX) functions. This week, we look at BITRSHIFT.

The BITRSHIFT function

It’s time to find the antidote to the recent BITLSHIFT function and you shouldn’t feel bitter (BITR?).  This function first converts the number to binary and then removes a specified number of digits from the right of the binary number, i.e. this function returns a number shifted right by the specified number of bits.

The BITRSHIFT function employs the following syntax to operate:

BITRSHIFT(number, shift_amount)

The BITRSHIFT function has the following arguments:

• number: this is required and is any DAX expression that returns an integer value
• shift_amount: also required.  This too is a DAX expression that must be an integer.

It should be further noted that:

• shifting a number right is equivalent to removing digits from the rightmost side of the binary representation of the number.  For example, a two-bit shift to the right on the decimal value 13 converts its binary value (1101) to 11, or 3 in decimal
• if the absolute value of shift_amount is greater than 64, BITRSHIFT will not return an error, but it will result in an underflow / overflow
• a negative number used as the shift_amount argument shifts the number of bits to the left
• a negative number used as the shift_amount argument returns the same result as a positive shift_amount argument for the BITLSHIFT function.