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

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.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.