Forum Discussion

CarlsBerg999's avatar
CarlsBerg999
Helper V
5 years ago
Solved

Error "comparing values integer with text"

Hi,
 
I'm getting the error "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." from the Measure below. I've gone through the entire measure can I am unable to find the issue. Any ideas?
 
- Measure [Sales Total] works, and produces no errors.
- DateTable[Year] = Whole Number
- [Task Status] = Text
- [Status] = Text
[Customer ID] = Text
 
This makes no sense to me. 
 
RANKX (
'Table3',
CALCULATE (
[Sales Total],
DateTable[Year] = YEAR ( TODAY () ),
'Table1'[Task Status] <> "Stopped",
'Table2[Status] <> "Cancelled",
ALLEXCEPT ('Table3', 'Table3'[Customer ID] )
),
,
DESC
)




  • Hi,

     

    The issue was somehow connceted to the the [Sales Total]. The measure was producing a result, but it had an underlying LOOKUPVALUES -reference that was broken. Quite honestly it seems like a bug to have the measure working in one place but not at another. Never the less, solved. 

5 Replies

  • tex628's avatar
    tex628
    Community Champion

    Hi CarlsBerg999 

    I'd advice you to comment out you filter statements, one at a time to find the one that is producing the error:

    RANKX (
    'Table3',
    CALCULATE (
    [Sales Total],
    // DateTable[Year] = YEAR ( TODAY () ),
    'Table1'[Task Status] <> "Stopped",
    'Table2[Status] <> "Cancelled",
    ALLEXCEPT ('Table3', 'Visuals Customer'[Customer ID] )
    ),
    ,
    DESC
    )
    


    If the measure works you move onto the next filter statement and eventually you should be able to determine which statement is porducing the error.

    Br, 
    J

     

    • CarlsBerg999's avatar
      CarlsBerg999
      Helper V

      Hi, i tried this and the error left when i got to the statement:

      ALLEXCEPT ('Table3', 'Table3'[Customer ID] )

       However, i don't understand why this is causing a problem. This doesn't really "compare" Customer ID with any data. It just removes filters. 

      • tex628's avatar
        tex628
        Community Champion

        That is indeed quite strange. If you try and move the calculate statment out of the rankx statement, do you still encounter issues? 

        Measure =
        
        CALCULATE (
        [Sales Total],
        DateTable[Year] = YEAR ( TODAY () ),
        'Table1'[Task Status] <> "Stopped",
        'Table2[Status] <> "Cancelled",
        ALLEXCEPT ('Table3', 'Visuals Customer'[Customer ID] )
        )