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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

If Else logic for multiple conditions

Hello Everyone,

 

I have three columns "worker type", "Work location" and "Vendor name" and need to create a conditional or a custom column(Resource Type) by taking all of this parameters

 

If "Worker type" is Employee then "resource type" is employee
else
If "worker type" equal to "Contingent Worker" then check "work country" like "India" or "Phillipness" then "offshore"
else check "vendor" name contains of "abcdef letters" then "onshore" else "Contractor".

 

 

1 ACCEPTED SOLUTION
ddpl
Solution Sage
Solution Sage

 
@Anonymous Create calculated column in DAX

Resource type =
SWITCH(
    TRUE(),
    'Table'[worker type] = "Employee","employee",
    'Table'[worker type] = "Contigent worker" && 'Table'[Work location] in {"India","Phillipness"},"offshore",
    'Table'[worker type] = "Contigent worker" && CONTAINSSTRING('Table'[Vendor name],"abcef"),"onshore","Contractor")

OR

You can create Custom column in power query asper below

 

Resource Type = 
if[worker type] = "Employee" then "employee"
else if [worker type] = "Contigent worker" and [Work location] = "India" or [Work location] = "Phillipness" then "offshore"
else if [worker type] = "Contigent worker" and Text.Contains([Vendor name],"abcdef") then "onshore"
else "Contractor"

 

 

 

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thank you that helped a lot.

ddpl
Solution Sage
Solution Sage

 
@Anonymous Create calculated column in DAX

Resource type =
SWITCH(
    TRUE(),
    'Table'[worker type] = "Employee","employee",
    'Table'[worker type] = "Contigent worker" && 'Table'[Work location] in {"India","Phillipness"},"offshore",
    'Table'[worker type] = "Contigent worker" && CONTAINSSTRING('Table'[Vendor name],"abcef"),"onshore","Contractor")

OR

You can create Custom column in power query asper below

 

Resource Type = 
if[worker type] = "Employee" then "employee"
else if [worker type] = "Contigent worker" and [Work location] = "India" or [Work location] = "Phillipness" then "offshore"
else if [worker type] = "Contigent worker" and Text.Contains([Vendor name],"abcdef") then "onshore"
else "Contractor"

 

 

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.