Binary.From

Updated on

Binary.From is a Power Query M function that creates a binary value from the given value, such as text, or returns null if the input is null. If the value is of any other type, an error is returned.

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

Syntax

Binary.From(
   value as any,
   optional encoding as nullable number,
) as nullable binary
ArgumentAttributeDescription
valueThe value to turn into a binary value.
encodingoptionalSpecifies the BinaryEncoding.Type that determines the encoding type applied to binary data.. By default, if this argument is not specified, the function uses BinaryEncoding.Base64, suitable for base-64 encoding. The alternative option available is BinaryEncoding.Hex, used for hexadecimal encoding.

Description

Returns a binary value from the given value. If the given value is null, Binary.From returns null. If the given value is binary, value is returned. Values of the following types can be converted to a binary value:

  • text: A binary value from the text representation. Refer to Binary.FromText for details.
If value is of any other type, an error is returned.

Examples

Get the binary value of "1011".

// Output: Binary.FromText( "1011", BinaryEncoding.Base64 )
Binary.From( "1011" )

Other functions related to Binary.From are:

BI Gorilla Youtube Channel

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