Forum Discussion

JPSingh's avatar
JPSingh
Frequent Visitor
2 years ago
Solved

Formula for IF text equal or another text contains else IF

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 ab...
  • dharmendars007's avatar
    2 years ago

    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

    LinkedIN