Forum Discussion

RodFinetti's avatar
RodFinetti
New Member
4 years ago
Solved

Calculated column with multiple text string conditions

Hi there,   After much searching and attemps, I can't seem to get this to work. I'm trying to create a calculated field where if the Program Type column contains either "NAPIS" "Meals (AWD)" or "Me...
  • VahidDM's avatar
    4 years ago

    Hi RodFinetti 

     

    Try this code to add a new column to your table:

    IN or Out =
    SWITCH (
        TRUE (),
        CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Program Type], "napis" )
            && CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Received Unit(s)], "NO" ), "Exclude",
        CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Program Type], "Meals (AWD)" )
            && CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Received Unit(s)], "NO" ), "Exclude",
        CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Program Type], "Meals AWD" )
            && CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Received Unit(s)], "NO" ), "Exclude",
        "Include"
    )

    Output:

     

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

    Appreciate your Kudos🙏!!