Forum Discussion

tejapowerbi123's avatar
7 years ago
Solved

Values comparision number to text

 

Hi,

Can any one help for below error?

In excel I have a valid price column and in that column has $amount and “Contract not started” comments, but when  I try to replicate below formula in power bi  I am getting below error.

 Start Date = IF([Valid Price]="CONTRACT NOT STARTED","N","Y")

 

Data Type for valid price in power bi =Decimal

DAX comparison operations do not support comparing values of type Number with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

thanks

  • AlexisOlson's avatar
    AlexisOlson
    7 years ago

     

    The data type of column [Valid Price] cannot be whole number or decimal if you have any rows with "Contract Not Yet Started". It would have to be text. I guess you don't have any rows that have that value?

10 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi tejapowerbi123

    It is not allowed to compare text and numbers. 

    Maybe use a number code for "CONTRACT NOT STARTED", like a negative number that I guess wont come up in prices? 

     

    • I tried below,

      Start Date = IF([Valid Price]=" ","N","Y")

      but getting the same error.

      • AlB's avatar
        AlB
        Community Champion

        tejapowerbi123

        Sure, you're still doing the same, comparing a number to text. 

        You could use the query editor to easily replace all occurrences of your text string with a number