CONVERT Function (DAX)

How does the CONVERT function (DAX) work?

As its name suggests, the CONVERT function (DAX) allows you to convert the data type of an expression to the one you specify.

CONVERT Formula Syntax

     <Expression>, <Datatype>

How do you use the CONVERT function?

This function has two parameters: the scalar expression and the data type. The CONVERT function returns an error when a value cannot be converted to the specified data type. The data type can be Boolean, currency, datetime, double, integer, and string.

Related Blog Posts

Related Support Forum Posts

Compare measures at different levels in a hierarcy
Calculating an Average of a Measure
Creating Plan / Actual for Year & Months

Considerations when using the CONVERT function

DAX calculated columns must be a single data type. Since MEDIAN and MEDIANX functions return mixed data types, they will return an error. To avoid mixed data types, change the expression to always return the double data type.

Related Video Tutorials

Formula examples using the CONVERT function

SELECT CONVERT(INT, 5.95) result

SELECT CONVERT( CHAR( 20 ), order_date, 104 )

SELECT CONVERT( CHAR( 20 ), order_date, 7 )

Related Course Modules

Center of Excellence


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