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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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
User | Count |
---|---|
98 | |
78 | |
77 | |
49 | |
26 |