Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Question on calculated column

Hi, I have a table contans customerId, Code columns. I want to add calculated column and populate either ture or false.   The condition is if any customer contains code C or D, then i need to add ...
  • v-luwang-msft's avatar
    4 years ago

    Hi Anonymous ,

    You could create a new column like the below:

    Column =
    IF (
        CONTAINS (
            FILTER ( Customer, Customer[CustomerID] = EARLIER ( Customer[CustomerID] ) ),
            Customer[Code], "C"
        )
            = TRUE ()
            || CONTAINS (
                FILTER ( Customer, Customer[CustomerID] = EARLIER ( Customer[CustomerID] ) ),
                Customer[Code], "D"
            )
                = TRUE (),
        TRUE (),
        FALSE ()
    )

    Output result:

     

    Did I answer your question? Mark my post as a solution!


    Best Regards

    Lucien