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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
sw123
Helper III
Helper III

New column with values based on another column

Hi,

I want to add a new column (B) based on another column (A). If the text string in Column A starts with either 1, N1, S1 or I1, column B should be textstring “C”. If the text string in Column A starts with either 2, N2, S2 or I2, column B should be textstring “D”. And so on. How do I do this?

Thankful for help!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @sw123 ,

 

can you check with below dax experssion:

NewColumn =
SWITCH(
    TRUE(),
    LEFT(Job_List[Description], 3) = "A &" || LEFT(Job_List[Description], 2) = "N1" || LEFT(Job_List[Description], 2) = "S1" || LEFT(Job_List[Description], 2) = "I1", "C",
    LEFT(Job_List[Description], 1) = "2" || LEFT(Job_List[Description], 2) = "N2" || LEFT(Job_List[Description], 2) = "S2" || LEFT(Job_List[Description], 2) = "I2", "D",
    // Add more conditions as needed
    "Other"
)

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @sw123 ,

 

can you check with below dax experssion:

NewColumn =
SWITCH(
    TRUE(),
    LEFT(Job_List[Description], 3) = "A &" || LEFT(Job_List[Description], 2) = "N1" || LEFT(Job_List[Description], 2) = "S1" || LEFT(Job_List[Description], 2) = "I1", "C",
    LEFT(Job_List[Description], 1) = "2" || LEFT(Job_List[Description], 2) = "N2" || LEFT(Job_List[Description], 2) = "S2" || LEFT(Job_List[Description], 2) = "I2", "D",
    // Add more conditions as needed
    "Other"
)
Daniel29195
Super User
Super User

@sw123 

 

can you share some sample data i can work on ? 

 

best regards

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.