CODE Function (DAX)

How does the CODE function (DAX) work?

The CODE function (DAX) will return a numeric value for the first character in a text string, which corresponds to a character set used by your computer.

CODE(
     text
)

How do you use the CODE function?

The CODE function is known as a text string used as a worksheet function in Excel. It can be entered as part of a formula in a cell of a worksheet.

Related Blog Posts

Related Support Forum Posts

Problem With SUMX With IF
DATEADD within SUMX returning 0 or blank
DAX formula involving Variable and AverageX

Considerations when using the CODE function

This function is used for the specified character to retrieve the ASCII value. If there is more than one character, the function will return the ASCII value for the first character and ignore all of the characters that come after the first.

Related Video Tutorials

Formula examples using the CODE function

=CODE(“A”)

=CODE(“!”)

=CODE(A2)

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI
Center of Excellence

DOWNLOAD


Download our comprehensive DAX Formula Reference Guide as perfect companion as you learn how to use DAX formulas within Power BI.


Download DAX Formulas Reference Guide
Download DAX Formula Reference Guide
Membership