Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

IF

Hi All,

 

I would like to create a calculated column using IF. I am not sure how to use multiple Logical test.

For eg:

I have a set of locations. And each location belong to a certain region. It looks something like the image below.

I want to create a calculated column called "Region" in PowerBI, where it checks what location and allot the particular region.

 

Can I please know how can I implement that?

 

Any help would be appreciated!

 

Thank you!

Megha

 

  • Hi Anonymous ,

    You can try below code:-

    Region =
    IF (
        LOCATION[Location] IN { "PL60", "MA81", "MA82" },
        "EMEA",
        IF ( LOCATION[Location] IN { "2201" }, "APAC", "NA" )
    )

    Thanks,

    Samarth

2 Replies

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi Anonymous ,

    You can try below code:-

    Region =
    IF (
        LOCATION[Location] IN { "PL60", "MA81", "MA82" },
        "EMEA",
        IF ( LOCATION[Location] IN { "2201" }, "APAC", "NA" )
    )

    Thanks,

    Samarth