cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Babinsky Regular Visitor
Regular Visitor

How to find a single character from a field and then create a new field

Hi all, I have a question for you.  

 

Do you know what the IF statement would be to find a single character from a field to create a new field?

 

For example:  When field A contains 'T' then create field B.  The field A is a text field for example T142536, S18273 etc...

 

I am trying to create a new field if the search criteria = T within field A

 

- Babinsky

1 ACCEPTED SOLUTION

Accepted Solutions
v-ljerr-msft Super Contributor
Super Contributor

Re: How to find a single character from a field and then create a new field

Hi @Babinsky,

 

Great to hear the problem got resolved! Could you accept the corresponding reply as solution to help others who may have similar issue easily find the answer and close this thread?Smiley Happy

 

Regards

12 REPLIES 12
Sean Super Contributor
Super Contributor

Re: How to find a single character from a field and then create a new field

I'm assuming you want a new COLUMN

 

Give this a Try

 

New Column =
IF (
    ISERROR ( FIND ( "T", Table[Column], 1 ) ),
    "No there's no T",
    "Yes there is a T"
)

Hope this helps.

Good Luck!Smiley Happy

Babinsky Regular Visitor
Regular Visitor

Re: How to find a single character from a field and then create a new field

I saw your reply thanks!

 

New Column = IF ( ISERROR ( FIND ( "T", Table[Column], 1 ) ), "No there's no T", "Yes there is a T" )

 

Is the following syntax standard?  "No there's no T", "Yes there is a T"

 

It doesn't look like normal coding procedures.  I trying to create a new field based on the contents another.

Sean Super Contributor
Super Contributor

Re: How to find a single character from a field and then create a new field

The question was: "Do you know what the IF statement would be to find a single character from a field to create a new field?"

 

My Normal Coding Procedures do not include reading minds. But you can output whatever you want

 

Find Function.png

 

Babinsky Regular Visitor
Regular Visitor

Re: How to find a single character from a field and then create a new field

Thanks for offering a suggestion.  this is getting me closer sorry for not being clear.

 

What I'm looking to create is for Example - Field1 contains ex: T000 and S000 and I want to create a new field with T000 only.

 

Not create a Yes or No value.

Sean Super Contributor
Super Contributor

Re: How to find a single character from a field and then create a new field

Do you want a New Column or a New Table?

 

This will give you the new COLUMN like in my picture above

 

New Column =
IF (
    ISERROR ( FIND ( "T", Table[Column], 1 ) ),
    BLANK(),
    Table[Column]
)

 Find Function2.png

 

paulag Regular Visitor
Regular Visitor

Re: How to find a single character from a field and then create a new field

how about using the left function

=if(left(Field A,1)="T",Field A,"")

temp.png

Babinsky Regular Visitor
Regular Visitor

Re: How to find a single character from a field and then create a new field

Thanks for the suggestions but they didn't work.  I found the solution if anyone is curious.

 

SELECT * FROM file

WHERE field1 LIKE 'T%';
 
That created the new field I wanted that contained the value T.
Sean Super Contributor
Super Contributor

Re: How to find a single character from a field and then create a new field

Okay then! Smiley Happy

paulag Regular Visitor
Regular Visitor

Re: How to find a single character from a field and then create a new field

Did that work for you?  I did it in Excel Power Query just to test it.  I can do a screen grab in PBI desktop if you want

Helpful resources

Announcements
GregDeckler

How to Get Your Question Answered Quickly

Power BI Super User, Greg Deckler, explains

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Ideas
Users Online
Currently online: 85 members 1,655 guests
Please welcome our newest community members: