Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
Calculated column
Calculated table
Measure
Visual calculation
Converts an expression of one data type to another.
Syntax
CONVERT(<Expression>, <Datatype>)
Parameters
| Term | Definition |
|---|---|
Expression |
Any valid expression. |
Datatype |
An enumeration that includes: BOOLEAN/LOGICAL, CURRENCY/DECIMAL, DATETIME, DOUBLE, INTEGER/INT64, STRING/TEXT. |
Return value
Returns the value of Expression, translated to Datatype.
Remarks
The function returns an error when a value cannot be converted to the specified data type.
DAX calculated columns must be of a single data type. Since MEDIAN and MEDIANX functions over an integer column return mixed data types, either integer or double, the following calculated column expression will return an error as a result:
MedianOrderQuantity = MEDIAN ( [Order Quantity] )To avoid mixed data types, change the expression to always return the double data type, for example:
MedianOrderQuantity = MEDIANX('Sales', CONVERT([Order Quantity], DOUBLE))This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.
Example
DAX query
EVALUATE { CONVERT(DATE(1900, 1, 1), INTEGER) }
Returns
| [Value] |
|---|
| 2 |