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
-
Replacing relationships with join functions in DAX
This article describes how to join tables in DAX when there are no relationships in the data model. The data lineage plays an essential role in this scenario. » Read more
-
Rounding errors with different data types in DAX
This article describes the possible rounding differences that can appear in DAX. They are related to the data types and the operation being performed: knowing these details helps you write more robust DAX formulas and avoid errors in comparisons. » Read more
Last update: Dec 4, 2024 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo
Microsoft documentation: https://docs.microsoft.com/en-us/dax/convert-function-dax