CONVERT DAX Function (Math and Trig)

Convert an expression to the specified data type.

Syntax

CONVERT ( <Expression>, <DataType> )
Parameter Attributes Description
Expression

An expression which needs to be converted.

DataType

An enumeration that includes: BOOLEAN/LOGICAL, CURRENCY/DECIMAL, DATETIME, DOUBLE, INTEGER/INT64, STRING/TEXT.

Return values

Scalar A single value of any type.

The value of the Expression converted to the desired DataType.

Remarks

CONVERT returns an error when it cannot convert Expression to DataType. For example, CONVERT ( “abc”, INTEGER ) returns an error. CONVERT ( 1E20, INTEGER ) also returns an error, because the value is too large for an integer.

When DataType is INTEGER, CONVERT rounds the value to the nearest integer. A value that ends in .5 is rounded away from zero. For example, CONVERT ( 2.5, INTEGER ) returns 3 and CONVERT ( -2.5, INTEGER ) returns -3. INT is different, because INT rounds down: INT ( 3.7 ) returns 3, but CONVERT ( 3.7, INTEGER ) returns 4.

When DataType is CURRENCY, CONVERT rounds the value to four decimal places. For example, CONVERT ( 1.123456, CURRENCY ) returns 1.1235.

When Expression is BLANK, CONVERT returns BLANK. The only exception is BOOLEAN: CONVERT ( BLANK (), BOOLEAN ) returns FALSE.

Use CONVERT when an expression must always return the same data type. For example, a calculated column must have a single data type. If an expression can return a variant (like a string with an integer number in some rows and a decimal number in other rows), use CONVERT ( <expression>, DOUBLE ) to always return a decimal number.

» 3 related articles

Examples

--  CONVERT converts any expression in the requested datatype
--  Supported data types are: 
--  INTEGER, DOUBLE, STRING, BOOLEAN, CURRENCY, DATETIME
EVALUATE 
    {
        ( "Date1", CONVERT ( "12/25/1966", DATETIME ) ),
        ( "Date2", CONVERT ( "12-25-1966", DATETIME ) ),
        ( "Date3", CONVERT ( 12345,        DATETIME ) ),
        ( "Date4", CONVERT ( FALSE,        DATETIME ) )
    }
Value1 Value2
Date1 1966-12-25 00:00:00
Date2 1966-12-25 00:00:00
Date3 1933-10-18 00:00:00
Date4 1899-12-30 00:00:00

Related articles

Learn more about CONVERT in the following articles:

Last update: Nov 2, 2026   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://learn.microsoft.com/en-us/dax/convert-function-dax

2018-2026 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Passed by Expression

This parameter is passed by expression and can be evaluated multiple times in different evaluation contexts.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of CONVERT? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA.