Forum Discussion

anupambit1797's avatar
anupambit1797
Iron Contributor
Oct 05, 2024
Solved

BinaryFormat.Binary , BinaryFormat.Byte,BinaryFormat.ByteOrder,BinaryFormat.Group,BinaryFormat.Lengt

Dear Experts,                     Greetings, I have a data like below( Most interesting is the Column "E"-> rat0BitMap:-   The max size of the Column "E" is 11 bits ( which is max numOfPRB ...
  • Lorenzo's avatar
    Oct 06, 2024

    Hi anupambit1797 

     

    All the functions you refer don't do what you think/expect. For Power Query a Binary is a data Type (cf. Data types in Power Query & Power Query M Primer (Part 9): Types - Logical, Null, Binary)

     

    As an example, if you invoke function Folder.Contents:

     

     

    = Folder.Contents("D:\abc\wxyz")

     

     

    you get something like:

    where each Binary in [Content] must be "decoded" with the appropriate function (Excel.Workbook for the first 2, Csv.Document/Lines.FromBinary for the 3rd). But, there isn't always - in PQ functions' shared library - one for all kind of Binaries. Remember a few years ago where there wasn't a Pdf.Tables function (for the 4th file)...

    Back to the functions you mentioned I suggest read Binary functions overview

     

    Dec2Bin & Bin2Dec with Power Query

    In the attached workbook you'll find 2 custom functions (not mine) as there's currently no PQ shared function similar to the Excel ones:

    and a TableResult query

     

    • In the 'Source' sheet I highlighted a couple of things for your attention
    • In the 'Result' sheet the [Excel_BinToDec_Error] highlights why PQ returns null values in [Excel_BinToDec] (= 120 errors)

     

    (Didn't investigate why Excel BIN2DEC returns -386 for Base = 1001111110)

Resources