DAX Function Guide

CONVERT
Empty image or helper icon

Sam McKay

CEO & Founder

How does the CONVERT 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

CONVERT(
     <Expression>, <Datatype>
)

How do you use the CONVERT?

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

Loading

Considerations when using the CONVERT?

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

Loading

Formula examples using the CONVERT

SELECT CONVERT(INT, 5.95) result

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

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

Related Courses

Loading