Forum Discussion

obothewizard's avatar
obothewizard
Helper I
5 years ago
Solved

Create column based on multiple values

Hi there,   I am trying to create a calculated column based on a Zipcode table. I would like to add a field to indicate the US state based on the existing area field in the data table. For example ...
  • AlB's avatar
    5 years ago

    Hi obothewizard 

    Create a calculated column:

    State =
    SWITCH (
        TRUE (),
        Table1[Area] IN { "Bronx", "Brooklyn", "Queens" }, "New York",
        Table1[Area] IN { "Bergen County", "Essex County" }, "New Jersey"
    )
    

     where you'll have to complete  { "Bronx", "Brooklyn", "Queens" }  and { "Bergen County", "Essex County" } with all the values 

    Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.