Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi there. I am trying to replicate a formula I use in excel but I am struggling to get this formula right into BI. I am not sure if this should be done in power query or DAX but I don't seem to be able to replicate this. Is anyone able to advise the best was about getting this formula in BI:
If ProjectType "Credit Project"
THEN IF Name contains "Managed Services" THEN "Credit - Managed Services" ELSE "Credit - Other"
ELSE IF Name contains "Client" THEN "Client" ELSE IF "Invoiced?" = "Yes"
THEN "Invoiced" ELSE IF LEFT (Name) = "Time off" OR LEFT (Name) = "Annual Leave"
THEN "Leave" ELSE "Unmapped"
Is this formula at all possible to do or would I need to break this down.
Solved! Go to Solution.
Hello @JPSingh ,
Give the below code a try
NewColumn =
IF(
'TableName'[ProjectType] = "Credit Project",
SWITCH(
TRUE(),
CONTAINSSTRING('TableName'[Name], "Managed Services"), "Credit - Managed Services",
CONTAINSSTRING('TableName'[Name], "Client"), "Client",
'TableName'[Invoiced?] = "Yes", "Invoiced",
LEFT('TableName'[Name], 8 )= "Time off" || LEFT('TableName'[Name], 12) = "Annual Leave", "Leave",
"Unmapped"),
BLANK() // or some other default value if ProjectType is not "Credit Project")
If you find this helpful , please mark it as solution and Your Kudos are much appreciated!
Thank You
Dharmendar S
Thank you. I have made some adjustments on the formula but this works 🙂
Hello @JPSingh ,
Give the below code a try
NewColumn =
IF(
'TableName'[ProjectType] = "Credit Project",
SWITCH(
TRUE(),
CONTAINSSTRING('TableName'[Name], "Managed Services"), "Credit - Managed Services",
CONTAINSSTRING('TableName'[Name], "Client"), "Client",
'TableName'[Invoiced?] = "Yes", "Invoiced",
LEFT('TableName'[Name], 8 )= "Time off" || LEFT('TableName'[Name], 12) = "Annual Leave", "Leave",
"Unmapped"),
BLANK() // or some other default value if ProjectType is not "Credit Project")
If you find this helpful , please mark it as solution and Your Kudos are much appreciated!
Thank You
Dharmendar S
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 58 | |
| 45 | |
| 40 | |
| 21 | |
| 18 |