BinaryFormat.ByteOrder

Updated on

BinaryFormat.ByteOrder is a Power Query M function that returns a binary format with the byte order specified by binaryFormat. The default byte order is ByteOrder.BigEndian.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

BinaryFormat.ByteOrder(
   binaryFormat as function,
   byteOrder as number,
) as function
ArgumentAttributeDescription
binaryFormatTakes a binaryformat function, whichas can be found at Binary Functions Overview. Examples are BinaryFormat.7BitEncodedSignedInteger, BinaryFormat.UnsignedInteger64, etc.
byteOrderSpecifies the sequence in which bytes are arranged, by using a ByteOrder.Type. By default, it is set to ByteOrder.BigEndian, where the most significant byte is placed first. Alternatively, ByteOrder.LittleEndian can be chosen, where the least significant byte is positioned first.

Description

The BinaryFormat.ByteOrder function is used to define the byte order for a given binary format. This function takes two inputs: a binary format function and a byte order type. The byte order type specifies the sequence of byte arrangement.

When executed, BinaryFormat.ByteOrder returns a new binary format function that applies the specified byte order to the given binary format. This functionality is important for accurately interpreting binary data in different byte order conventions.

Examples

An example of how you can use BinaryFormat.ByteOrder is the following:

BinaryFormat.ByteOrder( 
   BinaryFormat.UnsignedInteger32, 
   ByteOrder.LittleEndian
) 

BI Gorilla Youtube Channel

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/binaryformat-byteorder