Open In App

Power BI- DAX Bitwise Functions

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.



 

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)

 

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)

 

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)

 

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)

 

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)

 

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>)
Article Tags :