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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
JonPT
Regular Visitor

Extract Special Character String /*

Hi Power BI Desktop Forum,

Newbie here who just joined and hoping you can assist me? Extensive searching and trial and error in PBI Desktop but no luck. Here's my scenario...

 

I'm trying to extract an exact special character string /* from column ALL_VALUES similar to below. Is this possible in Power BI Desktop?

 

ALL_VALUES

/*
/value1/*;/*

/*;/value1/*

/value1*;/value2*;value3/*;value4/*;/*

/*value1*;/*value2*/*;*value3/*;value4/*;/*

 

Extraction Required Description

Extract only the exact special character string /*

IF there is no text before or after /*

AND if it is between delimiters ;

FROM ALL_VALUES to a new column WILDCARD_ONLY

 

Extraction Required

ALL_VALUES

/*                     # Extract /*

/value1/*;/*     # Extract last /* after delimiter ;

/*;/value1/*     # Extract first /* before delimiter ;

/value1*;/value2*;/*;value3/*;value4/* # Extract middle /* between delimiters ;

/*value1*;/*value2*/*;*value3/*;value4/*;/* # Extract last /* after delimiter ;

 

Example Output

WILDCARD_ONLY

/*           # /* extracted

/*           # Last /* extracted

/*           # First /* extracted

/*           # Middle /* extracted

/*           # Last /* extracted

 
(everything after # are comments to explain the requirement per line)

 

Any assistance would be greatly appreciated

 

Thank you

Regards

JonPT

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @JonPT - In power query editor custom column window, you can use Text.Split and List.Select functions to isolate the exact /* string that meets your criteria.If you need to extract based on more complex rules (like excluding /* if it’s part of a larger string), you might need to add more conditions in the List.Select function

 

let
// Split the string by semicolon
SplitValues = Text.Split([ALL_VALUES], ";"),
// Select only entries that are exactly '/*'
FilteredValues = List.Select(SplitValues, each Text.Trim(_) = "/*")
in
if List.Count(FilteredValues) > 0 then
Text.Combine(FilteredValues, ";")
else
null

 

rajendraongole1_0-1728041734927.png

 

Hope this works in your scenerio





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

4 REPLIES 4
rajendraongole1
Super User
Super User

Hi @JonPT - In power query editor custom column window, you can use Text.Split and List.Select functions to isolate the exact /* string that meets your criteria.If you need to extract based on more complex rules (like excluding /* if it’s part of a larger string), you might need to add more conditions in the List.Select function

 

let
// Split the string by semicolon
SplitValues = Text.Split([ALL_VALUES], ";"),
// Select only entries that are exactly '/*'
FilteredValues = List.Select(SplitValues, each Text.Trim(_) = "/*")
in
if List.Count(FilteredValues) > 0 then
Text.Combine(FilteredValues, ";")
else
null

 

rajendraongole1_0-1728041734927.png

 

Hope this works in your scenerio





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Many thanks @rajendraongole1. That worked perfectly. Really appreciate your super quick response.

Kedar_Pande
Super User
Super User

DAX Logic to Extract /*

WILDCARD_ONLY = 
VAR StringToSearch = 'YourTable'[ALL_VALUES]
VAR Pattern = "/*"
VAR Delimiter = ";"
VAR PositionFirst = SEARCH(Pattern, StringToSearch, 1, 0)
VAR PositionLast = SEARCH(Pattern, StringToSearch, LEN(StringToSearch) - LEN(Pattern), 0)
VAR ExtractedFirst = IF(AND(MID(StringToSearch, PositionFirst - 1, 1) = Delimiter || PositionFirst = 1, MID(StringToSearch, PositionFirst + 2, 1) = Delimiter || LEN(StringToSearch) = PositionFirst + 1), Pattern, BLANK())
VAR ExtractedLast = IF(AND(MID(StringToSearch, PositionLast - 1, 1) = Delimiter || PositionLast = 1, MID(StringToSearch, PositionLast + 2, 1) = Delimiter || LEN(StringToSearch) = PositionLast + 1), Pattern, BLANK())
RETURN
IF(
NOT(ISBLANK(ExtractedFirst)),
ExtractedFirst,
IF(NOT(ISBLANK(ExtractedLast)), ExtractedLast, BLANK())
)

 

Let me know if you need further adjustments or clarification!

 

 

If this helped, a Kudos 👍 or Solution mark would be great!
Cheers,
Kedar Pande
www.linkedin.com/in/kedar-pande 

Thank you @Kedar_Pande for your detailed DAX response. @rajendraongole1 solution worked for me as well which I marked as the solution. But I will definitely keep your DAX solution in my back pocket for potential future scenarios.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors