Forum Discussion

dtango9's avatar
dtango9
Icon for Helper II rankHelper II
6 years ago
Solved

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

Hello,


I'm wondering why this formula isn't working and how to correct it - this is the error message I'm getting:  "DAX comparison operations do not support comparing values of type Text with values of type Integer.  Consider using the VALUE or FORMAT function to convert one of the values.  Any help is greatly appreciated! 🙂

Connects = CALCULATE(COUNT('phonecalls'[actualend]),FILTER('phonecalls','phonecalls'[Acct Number]='new_product'[Account Number] && 'phonecalls'[actualend]>='new_product'[new_startdate] && 'phonecalls'[actualend]<='new_product'[new_enddate])) + CALCULATE(COUNT('Annotations'[createdon]),FILTER(Annotations,'Annotations'[Acccount #] ='new_product'[Account Number] && 'Annotations'[createdon]>='new_product'[new_startdate] && 'Annotations'[createdon]<='new_product'[new_enddate].[Date]))
  • Anonymous's avatar
    Anonymous
    6 years ago

    dtango9 

     

    Check the data types of the filtered columns, for example 'phonecalls'[Acct Number]='new_product'[Account Number] both columns should be the same data type usually Whole number. Also, for [actualend], [new_startdate], [new_enddate]), [createdon], sometimes dates can displayed in numerical form (20200101) or Text form(01 Jan 2020), usually we need to change them to Date or Date/Time format. 

     

    You used Format() to change datatype or just change the datetype on Desktop menu.

     

    Paul Zheng _ Community Support Team
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

     

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    dtango9 

     

    Check the data types of the filtered columns, for example 'phonecalls'[Acct Number]='new_product'[Account Number] both columns should be the same data type usually Whole number. Also, for [actualend], [new_startdate], [new_enddate]), [createdon], sometimes dates can displayed in numerical form (20200101) or Text form(01 Jan 2020), usually we need to change them to Date or Date/Time format. 

     

    You used Format() to change datatype or just change the datetype on Desktop menu.

     

    Paul Zheng _ Community Support Team
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

     

    • dtango9's avatar
      dtango9
      Icon for Helper II rankHelper II

      Thank you so much!  Formatting was the issue 🙂

    • E0657198's avatar
      E0657198
      New Member

      Hi,

       

      I am also facing same issue and I tried with above solution but its not working. Any help greatly appreaceated!
      "DAX comparison operations do not support comparing values of type Integer with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values."

      Mileage = IF(CALCULATE(FIRSTNONBLANK('Requested_VIN List'[Mileage],1),FILTER(ALL('Requested_VIN List'),'Requested_VIN List'[VIN]='Fleet Ref_VIN_List'[VIN]))="","-",CALCULATE(FIRSTNONBLANK('Requested_VIN List'[Mileage],1),FILTER(ALL('Requested_VIN List'),'Requested_VIN List'[VIN] ='Fleet Ref_VIN_List'[VIN])))

       

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

    dtango9 
    I have modified your measure

    Connects =
    VAR _new_startdate =
        SELECTEDVALUE ( 'new_product'[new_startdate] )
    VAR _new_enddate =
        SELECTEDVALUE ( 'new_product'[new_enddate] )
    VAR _Phonecalls =
        CALCULATE (
            COUNT ( 'phonecalls'[actualend] ),
            FILTER (
                'phonecalls',
                'phonecalls'[Acct Number] = 'new_product'[Account Number]
                    && 'phonecalls'[actualend] >= _new_startdate
                    && 'phonecalls'[actualend] <= _new_enddate
            )
        )
    VAR _Annotation =
        CALCULATE (
            COUNT ( 'Annotations'[createdon] ),
            FILTER (
                Annotations,
                'Annotations'[Acccount #] = 'new_product'[Account Number]
                    && 'Annotations'[createdon] >= _new_startdate
                    && 'Annotations'[createdon] <= _new_enddate
            )
        )
    VAR result = _Phonecalls + _Annotation
    RETURN
        result

    Try this. If it is not working, use the table visual then return the variables one by one and identify which module is creating an issue.

     



    Did I answer your question? Mark my post as a solution!
    Appreciate with a kudos
    🙂