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
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
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.