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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors