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
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Kudoed Authors