Binary.FromList is a Power Query M function that converts a list of numbers into a binary value. The function returns a binary value representing the list of numbers.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Binary.FromList( list as list ) as binary
Description
The Binary.FromList function takes a list of numeric values (each 0–255) and packs them into a binary buffer. You can then feed that buffer into functions like Binary.ToText to get a hex string.
Examples
One example that uses Binary.FromList is below code that transforms a RGB value into HEX:
let
// 1) Hard-coded RGB string
RGB = "255, 128, 64",
// 2) Split into three text parts
parts = Text.Split(RGB, ","),
// 3) Trim spaces and convert to numbers
nums = List.Transform(parts, each Number.From(Text.Trim(_))),
// 4) Pack the numbers into a binary buffer
bin = Binary.FromList(nums),
// 5) Convert the binary buffer into a raw hex string
hexRaw = Binary.ToText(bin, BinaryEncoding.Hex),
// 6) Uppercase and prefix with “#”
result = "#" & Text.Upper(hexRaw)
in
result
This example uses Binary.FromList to turns the list of RGB values into a binary value. Binary.ToText then uses the BinaryEncoding.Hex enumeration to turn the result into a HEX value. The code then concatenates these values into a single RGB value.
Related articles
Learn more about Binary.FromList in the following articles:
- Convert RGB to HEX in Power Query M
This article shows how you can convert RGB values into HEX. » Read more
Related functions
Other functions related to Binary.FromList are:
2023-2026 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy