Open In App

Power BI- DAX Bitwise Functions

Improve
Improve
Like Article
Like
Save
Share
Report

To generate formulas and expressions in Excel data models for Power BI, Analysis Services, and Power Pivot, Data Analysis Expressions (DAX), a group of functions and operators, can be combined. Data Analysis Expression is a feature of the Power BI toolset that enables business analysts to maximize the value of their datasets. These expressions make the process of creating reports faster and more enjoyable for the data analyst. Report designers use the approximately 200 functions and operators in the DAX library in Power BI to do calculations and data analysis.

DAX Bitwise Functions

The new Bitwise DAX function, which was released in November 2021, is the main topic of this section. Let’s practice Bitwise DAX functions on a sample Dataset.

sample-data

 

DAX BITAND

A bitwise AND of two numbers is returned.

Syntax: BITAND(<number>, <number>)

  • Number: Any DAX expression that yields an expression with an integer value.
  • Shift_Amount: Any DAX expression that produces an expression of an integer.

Example: bit and = BITAND(2,30)

BitAnd-function

 

DAX BITLSHIFT

DAX Bitlshift function Returns an integer with the provided number of bits moved to the left.

Syntax: BITLSHIFT(<Number>, <Shift_Amount>)

  • Number: Any DAX expression that yields an expression with an integer value.
  • Shift_Amount: Any DAX expression that produces an expression of an integer.

Example: bit lshift = BITLSHIFT(2,45)

BitLshift-function

 

DAX BITOR

A bitwise OR of two numbers is returned.

Syntax: BITOR(<number>, <number>)

  • number: Any scalar expression with a numeric result. It is shortened if it is not an integer.

Example: bit or = BITOR(8,260)

BitOr-function

 

DAX BITRSHIFT

A bitwise OR of two numbers is returned.

Syntax: BITRSHIFT(<Number>, <Shift_Amount>)

  • Number: Any DAX expression that yields an expression with an integer value.
  • Shift_Amount: Any DAX expression that produces an expression of an integer.

Example: bit rshift = BITRSHIFT(8,260)

BitRShift-function

 

DAX BITXOR

A bitwise XOR of two numbers is returned.

Syntax: BITXOR(<number>, <number>)

  • number: Any scalar expression with a numeric result. It is shortened if it is not an integer.

Example: bit xor = BITXOR(2,45)

Bitxor-function

 

This grouping can be summarized as follows,

DAX Function

Description

Syntax

BITAND A bitwise AND of two numbers is returned. BITAND(<number>, <number>)
BITLSHIFT Returns an integer with the provided number of bits moved to the left. BITLSHIFT(<Number>, <Shift_Amount>)
BITOR A bitwise OR of two numbers is returned. BITOR(<number>, <number>)
BITRSHIFT A bitwise OR of two numbers is returned. BITRSHIFT(<Number>, <Shift_Amount>)
BITXOR A bitwise XOR of two numbers is returned. BITXOR(<number>, <number>)

Last Updated : 23 Jan, 2023
Like Article
Save Article
Share your thoughts in the comments
Similar Reads