Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How can i convert "-" to 0 (zero)

Hi, i have a column which is include celebrities' instagram followers count. But this column includes values as text data type. Furthermore, if an celebrity do not have any instagram account followers count is shown as "-". How can i convert "-" to 0 (zero). Then how can i convert text data type to integer?

Thank you.

  • Hi Anonymous 

    you can create a another column with below code:-

     

     

    Column = IF('Table (4)'[Column1] = "-",0,INT('Table (4)'[Column1]))

     

     

    Or in case you dont want to create a new column then in transform data tab you can right click on your column and select replace value

     

    and replace "-" with 0

    click ok, Now on the top from the transform ribbon change data type to whole number:-

     

    Thanks,

    Samarth

3 Replies

  • Samarth_18's avatar
    Samarth_18
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

    you can create a another column with below code:-

     

     

    Column = IF('Table (4)'[Column1] = "-",0,INT('Table (4)'[Column1]))

     

     

    Or in case you dont want to create a new column then in transform data tab you can right click on your column and select replace value

     

    and replace "-" with 0

    click ok, Now on the top from the transform ribbon change data type to whole number:-

     

    Thanks,

    Samarth

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you, i solved my problem thanks to your suggestion.

      • Samarth_18's avatar
        Samarth_18
        Icon for Community Champion rankCommunity Champion

        Great! it helps you. Kindly accept my answer as solution so that it will help other to find it more quickly.