Forum Discussion

Jo_Kas's avatar
Jo_Kas
Regular Visitor
4 years ago
Solved

IF Formula with 2 columns

Hello Dear Power Community,

I appeal to your expertise 😄 !

 

I would like to create a dax formula where 2 columns from the same table CLI [C_MTCRE]) / CLI [C_ASSCRE] should have specific conditions.

 

I would like to create the following DAX formula.

 

1 / Displays the text “OK” if CLI [C_MTCRE] <> 0 and if CLI [C_ASSCRE] = true
2 / Displays the text “REFUSED” if CLI [C_MTCRE] = 0 and if CLI [C_ASSCRE] = true
3 / Displays the text “NOT REQUESTED” if CLI [C_MTCRE] = 0 and if CLI [C_ASSCRE] = false
4 / Display the text “Error” if CLI [C_MTCRE] <> 0 and if CLI [C_ASSCRE] = false

 

Thanking you in advance for your help!

 

Sincerly Yours,

  • Jo_Kas , Try a new column

     

    Switch(true(),
    CLI [C_MTCRE] <> 0 && CLI [C_ASSCRE] = true() , "OK",
    CLI [C_MTCRE] = 0 && CLI [C_ASSCRE] = true(), "REFUSED",
    CLI [C_MTCRE] = 0 && CLI [C_ASSCRE] = false(), "NOT REQUESTED",
    CLI [C_MTCRE] <> 0 && CLI [C_ASSCRE] = false(), "Error"
    )

2 Replies

  • Jo_Kas , Try a new column

     

    Switch(true(),
    CLI [C_MTCRE] <> 0 && CLI [C_ASSCRE] = true() , "OK",
    CLI [C_MTCRE] = 0 && CLI [C_ASSCRE] = true(), "REFUSED",
    CLI [C_MTCRE] = 0 && CLI [C_ASSCRE] = false(), "NOT REQUESTED",
    CLI [C_MTCRE] <> 0 && CLI [C_ASSCRE] = false(), "Error"
    )

    • Jo_Kas's avatar
      Jo_Kas
      Regular Visitor

      Exceptional! It works. Thank you so much