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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mdex
Resolver I
Resolver I

Find in string BE followed by 2 numbers?

Hi,

 

I need to highlight all rows that have the letters BE followed by 2 numbers in a long text field. Is this possible?

 

Thanks in advance

1 ACCEPTED SOLUTION
tex628
Community Champion
Community Champion

Ohh, 

Try this: 

List.Transform(
List.RemoveItems(
List.Transform(
List.RemoveFirstN(
Text.Split([Column1] , "BE"),
1),
each try
Number.FromText(Text.End(Text.Start("BE" & _,4),2)) otherwise null 
), {null}
), each "BE" & Number.ToText(_))

 


Connect on LinkedIn

View solution in original post

9 REPLIES 9
amitchandak
Super User
Super User

@mdex , a new measure

If(left(max(Table[Column]),2)  = "BE" && mid( max(Table[Column]),3,1) >= '0' &&  mid( max(Table[Column]),3,1) <= '9' && mid( max(Table[Column]),4,1) >= '0' &&  mid( max(Table[Column]),4,1) <= '9', "Green", "red")

 

And use this  conditional formatting using the filed value How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

Hi,

 

Thanks for helping. This is very close but seems to be expecting "BE" to be at the start of the field, it could actually be anywhere.

 

E.g. "TEST REVIEW BE22 Incident"

tex628
Community Champion
Community Champion

Hi @mdex

I would proberbly use the Split on delimiter or extract on delimiter functions in Power Query to identify if there is a "BE" present in the string column. Then with your new column from the split you can then use a LEFT( Table[Column] , 2) to identify the two numbers. 

Br, 
Johannes


Connect on LinkedIn

If BE appears in a word before the BE22 then that would cause problems?

"Been to visit BE22"

tex628
Community Champion
Community Champion

Hi! 

You are very correct. I've created a new power query column that you can try! 

List.Transform(
List.RemoveItems(
List.Transform(
Text.Split([Column1] , "BE"),
each try
Number.FromText(Text.End(Text.Start("BE" & _,4),2)) otherwise null 
), {null}
), each "BE" & Number.ToText(_))


It might be a good idea to uppercase the column first. 

I've also attached a pbix to this message. 

/ J


Connect on LinkedIn

Really appreciate the assistance tex and sorry for coming back so late.

 

This method doesn't quite work either. Using your example pbix it identifies some incorrect BE## combinations.

 

mdex_0-1639042900220.png

 

tex628
Community Champion
Community Champion

Ohh, 

Try this: 

List.Transform(
List.RemoveItems(
List.Transform(
List.RemoveFirstN(
Text.Split([Column1] , "BE"),
1),
each try
Number.FromText(Text.End(Text.Start("BE" & _,4),2)) otherwise null 
), {null}
), each "BE" & Number.ToText(_))

 


Connect on LinkedIn

Thanks so much tex, Now I'll research those functions and find out what they actually do!

tex628
Community Champion
Community Champion

No worries! Let me know if there is anything you're wondering about 🙂


Connect on LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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