Forum Discussion

22LACMT's avatar
22LACMT
Helper III
2 years ago
Solved

If dax with columns

Hi Im trying to write the below if statement.  the if funtion wants the 2 columns to be measures.  so I used the selecedvalue to turn the columns into measures. but I am getting the error: do not surrport compairing values of type text with values of type 
 
 
 
DAX:   SFFandCCRC_indicator =
var blue = SELECTEDVALUE(ProviderInfo[SFF])
var green = SELECTEDVALUE(PIPastMonth1[Special Focus Status])
return if(OR(blue =  or("SFF", "SFF Candidate"), (green = or("SFF", "SFF Candidate"))), "True", "False")
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi 22LACMT ,

     

    As far as I know,"||" should be OR function in Dax. Grey's code should work and please check your data model.

    Also you can update your code as below.

    SFFandCCRC_indicator = 
    VAR blue =
        SELECTEDVALUE ( ProviderInfo[SFF] )
    VAR green =
        SELECTEDVALUE ( PIPastMonth1[Special Focus Status] )
    RETURN
        IF (
            OR ( blue IN { "SFF", "SFF Candidate" }, green IN { "SFF", "SFF Candidate" } ),
            "True",
            "False"
        )

    You can download my sample file to learn more details.

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

5 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    22LACMT I *think* you want this:

    var blue = SELECTEDVALUE(ProviderInfo[SFF])
    var green = SELECTEDVALUE(PIPastMonth1[Special Focus Status])
    return 
      if( blue = "SFF" || blue = "SFF Candidate" || green = "SFF" || green = "SFF Candidate", "True", "False")
    • 22LACMT's avatar
      22LACMT
      Helper III

      thank you, can I ask what || mean

       

       

    • 22LACMT's avatar
      22LACMT
      Helper III

      Hi, 

      everything is showing as false and their should be 12 true.  do you think it is the selected value. 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi 22LACMT ,

         

        As far as I know,"||" should be OR function in Dax. Grey's code should work and please check your data model.

        Also you can update your code as below.

        SFFandCCRC_indicator = 
        VAR blue =
            SELECTEDVALUE ( ProviderInfo[SFF] )
        VAR green =
            SELECTEDVALUE ( PIPastMonth1[Special Focus Status] )
        RETURN
            IF (
                OR ( blue IN { "SFF", "SFF Candidate" }, green IN { "SFF", "SFF Candidate" } ),
                "True",
                "False"
            )

        You can download my sample file to learn more details.

         

        Best Regards,
        Rico Zhou

         

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

         

  • Im missing something there should be 12 records and there are none marked as true