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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
MichaelBauld
Frequent Visitor

Extracting the first letter after a defined text string within a column

Hi all, 

 

I have a dashboard showing invoice payments by supplier name. This is filtered by the first letter of each supplier account as processing invoices is assigned to staff  by the first letter of the supplier name (i.e. staff member 1 has invoices from suppliers starting with 'E' and 'F'). To pull the first letter I initially just used a calculated column alongside the 'supplier name' column to pull the first letter from the left of the supplier name:

 

=LEFT('Pay run data'[Supplier name],1))

 

However, it appears that some supplier names have a trading name and an invoicing name. These supplier accounts usually list the name in the following format:

 

EXAMPLE: 'John Scott Joinery t/a Scott Joinery' (so should be logged a 'S' not 'J')

 

So my challenge is, for suppliers where this is relevant, how can I pull the first letter after 't/a' in the name (or the first letter of the whole text string if 't/a' is not present)? Any advice would be gratefully recieved!

 

Thanks

Michael

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@MichaelBauld , Try like

 


Pos = var _pos = SEARCH([Column1],,0)+4
return
mid([Column1],_pos,1)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
ddpl
Solution Sage
Solution Sage

@MichaelBauld ,

Try below steps in Power Query...

 

Step 1: Replace "t/a " (t/a[space]) with ","

 

Step 2: Add a Custom Column...

Your Need = if Text.Contains( [Suppliers], "," ) = true 
then Text.Start( Text.AfterDelimiter( [Suppliers], "," ), 1 )
else Text.Start( [Suppliers], 1 )

 

Hope it will work for you.

amitchandak
Super User
Super User

@MichaelBauld , Try like

 


Pos = var _pos = SEARCH([Column1],,0)+4
return
mid([Column1],_pos,1)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks @amitchandak , using this variable and combined with the IF and MID functions I've the column pulling the correct letters. 

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.