Forum Discussion

gpiero's avatar
gpiero
Skilled Sharer
7 years ago
Solved

Help to use LIst.Contains()

  Hi,   I am trying to explore how to use List.Contains without results. I would like to define list of Customer Code List.Contains() instead of write a lot of rows with "or". The code below doe...
  • v-juanli-msft's avatar
    7 years ago

    Hi gpiero 

    It is easy with DAX,

    Create a calculated column

    Column =
    IF (
        [Delivery Type] IN { "ZSDS", "ZSPD" }
            && [Customer Code] = 32,
        TRUE (),
        IF (
            [Delivery Type] IN { "ZSDS", "ZSPD" }
                && [Customer Code] = 149
                && [Code Add.Goods] IN { 1033, 1495, 32, 300001 },
            TRUE ()
        )
    )
    

    Assume [Customer Code] and [Code Add.Goods] are of number type not text,

    If they are text, replace [Customer Code] = 32 with [Customer Code] = "32",

    [Code Add.Goods] IN { 1033, 1495, 32, 300001 } with [Code Add.Goods] IN { "1033", "1495", "32", "300001" }.

     

    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.