Forum Discussion

BBIUser's avatar
BBIUser
Helper IV
7 years ago
Solved

Error DAX comparison operations do not support comparing values of type Text with values of type Int

Hi,

 

How do I show the result set in a 'Multi-row card of only 0 values from the Custom Column? 

Sample data is provided below:

 

- Difference is a Custom Column which I created in the Power Query Editor [Example 'Diff' shown in above image]

"Column 2 - Column 1"

- Next, I have created a MEASURE to place them in the Multi-row card.

Measure = CALCULATE(COUNTROWS(FILTER('Table1', 'Table1'[Diff]=0)))

 

This is when I get an calculation error in measure. Do I need to use some other expression?

 

Appreciate your response. Thanks!

 

  • BBIUser

     

    Seems to me that DIFF column is formatted as text.

     

    Try this

     

    Measure =
    CALCULATE ( COUNTROWS ( FILTER ( 'Table1', VALUE ( 'Table1'[Diff] ) = 0 ) ) )
    
  • Hi BBIUser

     

    You may try to change the type of Diff column to 'Whole Number'. Then your measure will not get the error.

     

    Regards,

    Cherie

10 Replies

  • v-cherch-msft's avatar
    v-cherch-msft
    Microsoft Employee

    Hi BBIUser

     

    You may try to change the type of Diff column to 'Whole Number'. Then your measure will not get the error.

     

    Regards,

    Cherie

    • BBIUser's avatar
      BBIUser
      Helper IV

      I was trying to change the Measure's data type to Whole number instead of the Custom Column. Changing the Custom Column to Whole Number data type with my original DAX worked for me as suggested by Cherie.

       

      Thanks for the Solutions v-cherch-msft , Zubair_Muhammad and Anonymous.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Does anyone know how to find the DAX error when you have formatted every single data table and combined data table to ensure there will be no format errors and there are no warning symbols on any files?  I hit the error when trying to add a new measure to a visual.  I am basically reproducing the same report I have already done but I need to change the number of reports so I started over and now I can't get any of the equations to work without the DAX format error.  Thanks

  • Anonymous's avatar
    Anonymous
    Not applicable

    Try:

     

    Measure = CALCULATE( COUNTROWS( 'Table1'[Diff] ) , FILTER('Table1', 'Table1'[Diff]=0 ) )

     

    CALCULATE( What to Calculate , Filter or other expression )

    • BBIUser's avatar
      BBIUser
      Helper IV

      Thanks Anonymous for the reply.

      I did try this expression before posting here with slight modification in it and I was getting the same error . I dint place ('Table1'[Diff]) , the coulmn since I had used the Custom Column which is not showing while creating this expression and shows only the Table Name for COUNTROWS.

       

      Measure = CALCULATE( COUNTROWS( 'Table1') , FILTER('Table1', 'Table1'[Diff]=0 ) )

       

      • Zubair_Muhammad's avatar
        Zubair_Muhammad
        Community Champion

        BBIUser

         

        Seems to me that DIFF column is formatted as text.

         

        Try this

         

        Measure =
        CALCULATE ( COUNTROWS ( FILTER ( 'Table1', VALUE ( 'Table1'[Diff] ) = 0 ) ) )
        
  • Anonymous's avatar
    Anonymous
    Not applicable

    I am returning the same error message with my code and am not sure which columns are not in the correct format... 

     

    I am trying to fill empty rows with entries later on.

  • MEGHS's avatar
    MEGHS
    Frequent Visitor

    hello, as I'm running into this same error, I'd like to see if someone can help: my columns are all date/time-formatted columns, and I still get the error. I suspect it has to do with the fact that there are empty cells which show "null" in Power Query. Can it be that PBI does not function to calculate the difference between two dates in case there are empty cells?? and if so, how would you suggest to fix it? thanks a lot!