#binary is a Power Query M function that creates a binary value from a list of numbers or a base 64 encoded text value.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
#binary( value as any ) as any
Description
The #binary function iis used to create a binary value from its input. This function can take either a list of numbers or a base 64 encoded text value and convert them into a binary format.
Examples
Let’s explore some examples of how to use the #binary function.
Creating a Binary Value from a List of Numbers
You can create a binary value from a list of hexadecimal numbers. Here’s how it works:
#binary( { 0x30, 0x31, 0x32 } ) // Returns Text.ToBinary( "012" )
In this example, the function #binary
takes a list of hexadecimal numbers { 0x30, 0x31, 0x32 }
and converts them into a binary value. This is equivalent to Text.ToBinary("012")
.
Creating a Binary Value from a Base 64 Encoded Text
If you want to provide a base 64 encoded text value, you can use the #binary function as follows:
#binary( "1011" ) // Returns Binary.FromText( "1011", BinaryEncoding.Base64 )
In this case, the function #binary takes the base 64 encoded text "1011"
and converts it to its binary form using Binary.FromText("1011", BinaryEncoding.Base64)
.
Related functions
Other functions related to #binary are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy