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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

How to extract string from name and create name group

Hey All,
Need help creating dax formula or calculated column to extract product density. Any help is greatly appreciated!

Need to go from left product column to right density group:

ProductDensity
A123 B1234 8Gbit 8 77/999 AE 1 AB8Gbit
A123 B12 4Gbit 16 7/999 ABCDE 1 AB4Gbit
A123 B1 2Gbit 16 77/999 AB 1 AB2Gbit
A123 B12346 512Gbit 8 77/99 ABCDE 512Gbit
A123 B123 77/999 ABCDE 1TB1TB


Thanks in advance!

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @Anonymous 

 

Try this code to add a new calculated column:

Column = 
VAR _G =
    FIND ( "Gbit", [Product],, -1 )
VAR _T =
    FIND ( "TB", [Product],, -2 )
RETURN
    IF (
        _G <> -1,
        RIGHT ( LEFT ( 'Table'[Product], _G + 4 ), 6 ),
        IF ( _T <> -2, RIGHT ( LEFT ( 'Table'[Product], _T + 1 ), 3 ), "" )
    )

VahidDM_0-1675216912676.png

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @Anonymous 

 

Try this code to add a new calculated column:

Column = 
VAR _G =
    FIND ( "Gbit", [Product],, -1 )
VAR _T =
    FIND ( "TB", [Product],, -2 )
RETURN
    IF (
        _G <> -1,
        RIGHT ( LEFT ( 'Table'[Product], _G + 4 ), 6 ),
        IF ( _T <> -2, RIGHT ( LEFT ( 'Table'[Product], _T + 1 ), 3 ), "" )
    )

VahidDM_0-1675216912676.png

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

ppm1
Solution Sage
Solution Sage

You can add a custom column with this expression in the query editor. Note that M is case sensitive, so you can add in Text.Upper or Text.Lower to avoid that issue if needed.

 

= List.Select(Text.Split([Product], " "), each Text.Contains(_, "Gb") or Text.Contains(_, "TB")){0}

 

ppm1_0-1675216762266.png

 

Pat

 

Microsoft Employee

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.