Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
gheecalipes25
Helper II
Helper II

Column with Multiple if conditions

Hi,

Good Day!

I am trying to create a new column that will give me the results below. i tried using the nested ifs or the switch function but is not working. i might have been doing it wrong. below is the data i am working on.

 

if Regionname = Anz, India, Philippines Then "APAC"

if Regionname = Bulgaria, Denmark, France, Germany, Greece, Ivory Coast, Morocco, Netherlands, Poland, Portugal, Senegal, Serbia, Spain, UK Then "EMEA"

if Regionname =Canada, US Then "NA"

if Regionname = Colombia, Mexico, Nicaragua, Panama Then "LATAM"

if Regionname =At Home then "W@H"

else Regionname

 

Thank you so much for the feedback and solutions. 🙂

 

2 ACCEPTED SOLUTIONS
jppv20
Solution Sage
Solution Sage

Hi @gheecalipes25 ,

 

Thy this formula:

Column=
IF(Regionname in {"Anz","India","Philippines"},"APAC",
IF(Regionname in {"Bulgaria","Denmark","France","Germany","Greece","Ivory Coast","Morocco","Netherlands","Poland","Portugal","Senegal","Serbia","Spain","UK"},"EMEA",
IF(Regionname in {"Canada","US"},"NA",
IF(Regionname in {"Colombia","Mexico","Nicaragua","Panama"},"LATAM",
IF(Regionname = "At Home","W@H",
Regionname)))))
 
If I answered your question, please mark it as a solution to help other members find it more quickly.

View solution in original post

AlexisOlson
Super User
Super User

I'd recommend a SWITCH.

 

Either like this:

Column =
SWITCH (
    TRUE (),
    Regionname IN { "Anz", "India", "Philippines" }, "APAC",
    Regionname
        IN {
        "Bulgaria",
        "Denmark",
        "France",
        "Germany",
        "Greece",
        "Ivory Coast",
        "Morocco",
        "Netherlands",
        "Poland",
        "Portugal",
        "Senegal",
        "Serbia",
        "Spain",
        "UK"
    }, "EMEA",
    Regionname IN { "Canada", "US" }, "NA",
    Regionname IN { "Colombia", "Mexico", "Nicaragua", "Panama" }, "LATAM",
    Regionname = "At Home", "W@H",
    Regionname
)


Or like this:

Column =
SWITCH (
    Regionname,
    "Anz", "APAC",
    "India", "APAC",
    "Philippines", "APAC",
    "Bulgaria", "EMEA",
    "Denmark", "EMEA",
    "France", "EMEA",
    "Germany", "EMEA",
    "Greece", "EMEA",
    "Ivory Coast", "EMEA",
    "Morocco", "EMEA",
    "Netherlands", "EMEA",
    "Poland", "EMEA",
    "Portugal", "EMEA",
    "Senegal", "EMEA",
    "Serbia", "EMEA",
    "Spain", "EMEA",
    "UK", "EMEA",
    "Canada", "NA",
    "US", "NA",
    "Colombia", "LATAM",
    "Mexico", "LATAM",
    "Nicaragua", "LATAM",
    "Panama", "LATAM",
    "At Home", "W@H",
    Regionname
)

View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

I'd recommend a SWITCH.

 

Either like this:

Column =
SWITCH (
    TRUE (),
    Regionname IN { "Anz", "India", "Philippines" }, "APAC",
    Regionname
        IN {
        "Bulgaria",
        "Denmark",
        "France",
        "Germany",
        "Greece",
        "Ivory Coast",
        "Morocco",
        "Netherlands",
        "Poland",
        "Portugal",
        "Senegal",
        "Serbia",
        "Spain",
        "UK"
    }, "EMEA",
    Regionname IN { "Canada", "US" }, "NA",
    Regionname IN { "Colombia", "Mexico", "Nicaragua", "Panama" }, "LATAM",
    Regionname = "At Home", "W@H",
    Regionname
)


Or like this:

Column =
SWITCH (
    Regionname,
    "Anz", "APAC",
    "India", "APAC",
    "Philippines", "APAC",
    "Bulgaria", "EMEA",
    "Denmark", "EMEA",
    "France", "EMEA",
    "Germany", "EMEA",
    "Greece", "EMEA",
    "Ivory Coast", "EMEA",
    "Morocco", "EMEA",
    "Netherlands", "EMEA",
    "Poland", "EMEA",
    "Portugal", "EMEA",
    "Senegal", "EMEA",
    "Serbia", "EMEA",
    "Spain", "EMEA",
    "UK", "EMEA",
    "Canada", "NA",
    "US", "NA",
    "Colombia", "LATAM",
    "Mexico", "LATAM",
    "Nicaragua", "LATAM",
    "Panama", "LATAM",
    "At Home", "W@H",
    Regionname
)
jppv20
Solution Sage
Solution Sage

Hi @gheecalipes25 ,

 

Thy this formula:

Column=
IF(Regionname in {"Anz","India","Philippines"},"APAC",
IF(Regionname in {"Bulgaria","Denmark","France","Germany","Greece","Ivory Coast","Morocco","Netherlands","Poland","Portugal","Senegal","Serbia","Spain","UK"},"EMEA",
IF(Regionname in {"Canada","US"},"NA",
IF(Regionname in {"Colombia","Mexico","Nicaragua","Panama"},"LATAM",
IF(Regionname = "At Home","W@H",
Regionname)))))
 
If I answered your question, please mark it as a solution to help other members find it more quickly.

Thank you.. it worked. 🙂

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.