CONVERT DAX Function (Math and Trig)
Convert an expression to the specified data type.
Syntax
Parameter | Attributes | Description |
---|---|---|
Expression |
An expression which needs to be converted. |
|
DataType |
An enumeration that includes: INTEGER, DOUBLE, STRING, BOOLEAN, CURRENCY, DATETIME. |
Return values
The value of the Expression converted to the desired DataType.
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:
-
Differences between INT and CONVERT in DAX
This article describes the small differences between INT and CONVERT in DAX that may end up returning different results in arithmetic expressions. » Read more
Last update: Dec 8, 2023 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo
Microsoft documentation: https://docs.microsoft.com/en-us/dax/convert-function-dax