BITRSHIFT

BITRSHIFT

How to Use the Power BI DAX function BITRSHIFT

What is the BITRSHIFT function?

The BITRSHIFT function is a DAX function that shifts the bits of a binary number to the left or right. This function takes two arguments: the first argument is the binary number, and the second argument is the number of bits to shift. The BITRSHIFT function returns the result of the binary shift operation.

How to use the BITRSHIFT function in Power BI

To use the BITRSHIFT function in Power BI, follow these steps:

1. Open Power BI Desktop and create a new report.

2. Import your data into Power BI using the Get Data option.

3. Create a new measure by clicking on the New Measure button in the Fields pane.

4. Type in the following formula for the BITRSHIFT function:


MeasureName = BITRSHIFT(BinaryNumber, NumberOfBits)


Replace MeasureName with the name of your measure, BinaryNumber with the name of the column that contains your binary number, and NumberOfBits with the number of bits you want to shift.

5. Click on the Enter button to save the measure.

6. Drag and drop the measure into your report to view the results.

Examples of using the BITRSHIFT function

Here are some examples of using the BITRSHIFT function in Power BI:

Example 1: Shifting bits to the right

Suppose you have a binary number 1010 (decimal value of 10) and you want to shift its bits to the right by 2 positions. You can use the BITRSHIFT function as follows:


MeasureName = BITRSHIFT(10, 2)


The result will be 2, which is the decimal value of the binary number 0010.

Example 2: Shifting bits to the left

Suppose you have a binary number 1100 (decimal value of 12) and you want to shift its bits to the left by 3 positions. You can use the BITRSHIFT function as follows:


MeasureName = BITRSHIFT(12, -3)


The result will be 96, which is the decimal value of the binary number 1100000.

The BITRSHIFT function in Power BI is a powerful tool for manipulating binary numbers. By using this function, you can shift the bits of a binary number to the left or right, which can be useful in various data analysis scenarios. Just follow the steps outlined in this article to start using the BITRSHIFT function in your Power BI reports.

Power BI DAX Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

Subject

Your Name (required)

Company/Organisation

Email (required)

Telephone

Training Course(s)

Your Message

Upload Example Document(s) (Zip multiple files)