cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tracyhopaulson
Resolver I
Resolver I

if statement custom column

I have a column "Item" that I would like to find all values start with "SK" or "78", then insert a text "Do Not Use" to the custom column, otherwise, carry the values from column Item over as is.  Can someone help with this please?

1 ACCEPTED SOLUTION
pranit828
Super User
Super User

Hi @tracyhopaulson 

 

I would create  a column

_new_column = IF(LEFT([column],2) IN {"SK","78"}, "Do Not Use",[column])





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

View solution in original post

5 REPLIES 5
pranit828
Super User
Super User

Hi @tracyhopaulson 

 

I would create  a column

_new_column = IF(LEFT([column],2) IN {"SK","78"}, "Do Not Use",[column])





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

View solution in original post

Ajinkya369
Resolver III
Resolver III

Hi @tracyhopaulson ,

 

Please provide sample data.

 

Thank you

@Ajinkya369  attaching image of data and the result I would like to achieve.  Need help with Dax formula or custom column formula please.  Thank you.

sample.PNG

 

 

@tracyhopaulson

Using the CONTAINSSTRING function:

CONTAINSSTRING.JPG





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






PaulDBrown
Super User
Super User

@tracyhopaulson 

You can create a custom column in Power Query to meet the output. The interface will allow you to choose between "contains" (to specify the string values) and the output can be custom or a column value

As an alternative, you can create a custom column using DAX in your table using the function CONTAINSTRING as the variable





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors