Converting Data Types with DAX CONVERT in Power BI

You can use the CONVERT function in DAX to change the data type of how a field is assessed in a formula without changing the data type for all other calculations. The CONVERT function is by far the most versatile, while there are some additional options for quickly converting from one data type to another.

When a field will always require a specific data type, we recommend making the changes in Power Query instead of DAX, especially when working with large data sets to avoid unnecessary processing time when users interact with reports. DAX is best suited for temporary or one-off data type conversions needed as part of more complex DAX formulas.

The DAX CONVERT Function

You can use the CONVERT function in DAX to modify a data type within a formula. This is exceptionally useful when you need to temporarily change how Power BI assesses a field in a formula. The syntax is: CONVERT([Field1], DataType).

The function accepts any incoming field when creating a New Column and supports the following output data types.

  • BOOLEAN – True / False
  • CURRENCY – Number with fixed decimal places
  • DATETIME – Date Time
  • DOUBLE – Number with infinite decimal places
  • INTERGER – Whole Number with no decimal places
  • STRING – Text

Here are some examples of using the CONVERT function.

Converting a Number to a String/Text with the DAX CONVERT function:

Value = CONVERT([Number],STRING)

Converting a String to a Number with the DAX CONVERT function:

Value = CONVERT([Text],DOUBLE)

Converting a String to an Integer with the DAX CONVERT function:

Value = CONVERT([Text],INTEGER)

You can learn more about the function from the official Microsoft documentation here: CONVERT function (DAX) – DAX | Microsoft Learn

Convert Text to Numbers with the DAX VALUE Function

You can use the VALUE function to create a New Column and convert a text field that contains numbers to a numeric data type. The syntax for the formula is as follows, where Text is the name of a field surrounded in square brackets.

Number = VALUE([Text])

Using the VALUE function is not always necessary as Power BI will attempt to automatically assess text columns that contain numbers as numeric data types.

You can learn more about the VALUE function here: VALUE function (DAX) – DAX | Microsoft Learn

Scroll to Top