Forum Discussion

domtrump's avatar
domtrump
Helper II
2 years ago

Calculated column - convert data type

I have a table in my data model that was loaded from a query. I have a column that came over as text. I need an additional column that has this column represented as an integer. No longer have access to the original data source so can't be done in power query. I tried the following from an example in the Help but it just results in error. 

Syntax

DAX
CONVERT(<Expression>, <Datatype>)  

 I type CONVERT(Table[MyTextColumn],INTEGER) 
Error: 

How can I accomplish what I need?

2 Replies

  • Cannot reproduce

     

    Table = ADDCOLUMNS({"10"},"num",CONVERT([Value],INTEGER))
     
    Show more of your DAX.
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi domtrump 

     

    Thanks for the reply from lbendlin , please allow me to provide another insight:

    In excel, the Syntax of Convert() function is that:

    CONVERT(number,from_unit,to_unit)

    Here are detailed description of this function:

    CONVERT function - Microsoft Support

     

    Best Regards

    Zhengdong Xu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.