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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
TcT85
Helper III
Helper III

Left function with IF

Hi,

 

Im trying to create a column with left function with certain number of letters/numbers depends on text string.

 

Data:

1111-1

2222-2

AAAA11

BBBB1122

 

The result im looking for:

1111

2222

AAAA11

BBBB11

 

So I only want 4 letters/numbers when there is symbol "-" and only maximum 6  letters/numbers,

How do I set this up?

 

 

 

1 ACCEPTED SOLUTION
JoBI
Resolver II
Resolver II

Hello,
You can try something like this:
LEFT(Column, MIN(IFERROR(SEARCH("-",Column),LEN(Column)+1)-1, 6))

View solution in original post

1 REPLY 1
JoBI
Resolver II
Resolver II

Hello,
You can try something like this:
LEFT(Column, MIN(IFERROR(SEARCH("-",Column),LEN(Column)+1)-1, 6))

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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