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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Anonymous
Not applicable

Remove the last character if it is a letter

Hiya,

 

I would like to add a new column in PBI and only remove the last character if i is letter. Could you please help? Thanks

 

Original ColumnNew Column
1234A1234
4321B4321
6789D6789
1234512345
1 ACCEPTED SOLUTION
vicky_
Super User
Super User

Try the following:

 

New Column = 
var ColumnLen = LEN('Table'[Column])
var lastCharacter = RIGHT('Table'[Column])
return IF(ISERROR(INT(lastCharacter)), LEFT('Table'[Column], columnLen - 1), 'Table'[Column])

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks it works perfectly 🙂

vicky_
Super User
Super User

Try the following:

 

New Column = 
var ColumnLen = LEN('Table'[Column])
var lastCharacter = RIGHT('Table'[Column])
return IF(ISERROR(INT(lastCharacter)), LEFT('Table'[Column], columnLen - 1), 'Table'[Column])

 

 

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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