Forum Discussion

poojik's avatar
poojik
Frequent Visitor
8 years ago

Error: DAX comparison operations do not support comparing values of type true/false

I am trying to create a new calcuated field to count all the account names if "ValidationStatus" is TRUE. The formula I am using is : 

 

Validated count = CALCULATE(DISTINCTCOUNT(accounts[name]),FILTER(accounts,VALUE(accounts[validationstatus])= TRUE()))

 

I am getting this error : 

DAX Comparision operations do not support comparing values of type Number with values of type True/False. Consider using value or FORMAT function to convert one of the values. 

 

Any help will be appriciated. 

 

Best

P

 

9 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Try this:

     

    CALCULATE(DISTINCTCOUNT(accounts[name]),accounts[validationstatus])= "TRUE")

    • poojik's avatar
      poojik
      Frequent Visitor

      I am still getting the same error. Screen-shot attached. 

  • Vvelarde's avatar
    Vvelarde
    Community Champion

    poojik

     

    Hi try with this

     

    Validated Count =
    CALCULATE (
        DISTINCTCOUNT ( Accounts[name] );
        FILTER ( Accounts; Accounts[validationstatus] = TRUE () )
    )

    Regards

     

    Victor

    • poojik's avatar
      poojik
      Frequent Visitor

      Vvelarde

      This was the first thing I tried previously but it didn't work. 

       

       

      • Vvelarde's avatar
        Vvelarde
        Community Champion

        poojik

         

        Double Check the Data Type

         

         

        With this this work:

         

         

        Regards

        Victor

  • Anonymous's avatar
    Anonymous
    Not applicable

    Can someone help me please. I have the following code and I keep getting this error. I have tried wrapping the calculate statement in a VALUE function and I get the message, cannot convert true/false.

     

    Inpatient comment =
    var newline2 =
    "
    "
    return
    if(
    CALCULATE([Per Member % Change],'Benefit Mapping'[Benefit Type]="inpatient">0.05),"Inpatient Costs:" & newline2 & "The average inpatient cost per member has increased year-over-year by " &FORMAT(CALCULATE([Per Member % Change],'Benefit Mapping'[Benefit Type]="inpatient"), "currency")& ". IP costs are sporadic in nature and can significantly increase or decrease overall costs; in this instance, IP increased overall costs",
    if (
    AND(CALCULATE([Per Member % Change],'Benefit Mapping'[Benefit Type]="inpatient")<=0.05,CALCULATE([Per Member % Change],'Benefit Mapping'[Benefit Type]="inpatient")>=-0.05 ),"inpatient Costs: " & newline2 & "The average inpatient cost per member has been roughly stable year-over-year (" &FORMAT(CALCULATE([Per Member % Change],'Benefit Mapping'[Benefit Type]="inpatient"), "currency")& " change year-over-year. IP costs are sporadic in nature and can significantly increase or decrease overall costs; in this instance, IP had minimal impact on overall costs",
    "Inpatient Costs:" & newline2 & "The average inpatient cost per member has decreased year-over-year by " &FORMAT(CALCULATE([Per Member % Change],'Benefit Mapping'[Benefit Type]="inpatient"), "currency")& ". IP costs are sporadic in nature and can significantly increase or decrease overall costs; in this instance, IP reduced overall costs"

    ))