HEX2DEC one liner implementation in Power Query M
✓ Published0🌍 Public
HHugoberry
Last edited Mar 2, 2017
Created on Mar 2, 2017
This example demonstrates a compact implementation of hexadecimal-to-decimal conversion in Power Query M, a formula language used in Microsoft Power BI and Excel. It shows how a single-line function can replace a multi-step conversion process. The code defines a custom function named `HEX2DEC` that takes a text string as input and applies the `Expression.Evaluate` API with the literal prefix “0x” to interpret the hexadecimal value. The function then returns the decimal result directly. The visualization highlights the elegance of using M’s expression evaluation for parsing, offering a practical alternative to built-in conversion functions.
AI-generated description