Forum Discussion

valerial's avatar
valerial
Icon for Helper I rankHelper I
6 years ago
Solved

Multiple conditions in a column dax

I am trying to select multiple values within one text and write mulitple ifs within one column something like this..

 

but this does not work how do i do this

if ([ACCOUNTNUM] = “B30001,B34123” and [Amount]>0 then “Reversal”

else if[ACCOUNTNUM] = “B30002,B12323” and [Amount]>0 then "Release"
else “Accrual"

9 Replies

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

    The code has to be very explicit with the logic test

    If I was you , I would get the account code bit working first then introduce the balance test.

    Is this an 'OR' test?

    if ([ACCOUNTNUM] = “B30001" OR [ACCOUNTNUM] = "B34123” ,
    
    
    
  • v-juanli-msft's avatar
    v-juanli-msft
    Icon for Community Support rankCommunity Support

    Hi valerial 

    Try columns below:

    Column =
    IF (
        [ACCOUNTNUM]
            IN {
            "B30001",
            "B34123"
        }
            && [Amount] > 0,
        "Reversal",
        IF (
            [ACCOUNTNUM]
                IN {
                "B30002",
                "B12323"
            }
                && [Amount] > 0,
            "Release",
            "Accrual"
        )
    )
    

     

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

  • valerial ,

    Please try

    Switch (true(),
    [ACCOUNTNUM] in { "B30001","B34123"} && [Amount]>0 , "Reversal" ,
    [ACCOUNTNUM] in {"B30002","B12323"} && [Amount]>0 , "Release",
    "Accrual"
    )