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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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 I
Resolver I

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 I
Resolver I

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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.