Forum Discussion
Anonymous
3 years agoNot applicable
Need to extract values from string based on my list
Hi brainy guys! I need to extract values form the string based on the values I have. For example: Values I need to find in the COLUMN - Names: ab,as,ad,af,ag,ah,aj Table: Num Names...
Greg_Deckler
Community Champion
3 years agoAnonymous Here is one way, PBIX is attached below signature:
Column =
VAR __ValuesToFind = { "ab", "as", "ad", "af", "ag", "ah", "aj" }
VAR __Begin = FIND("(", [Names], ,0) + 1
VAR __End = LEN([Names])
VAR __Path = SUBSTITUTE(MID([Names],__Begin, __End - __Begin),"/","|")
VAR __Table =
ADDCOLUMNS(
GENERATESERIES(1,PATHLENGTH(__Path),1),
"__Value",PATHITEM(__Path,[Value])
)
VAR __Result = CONCATENATEX(INTERSECT(SELECTCOLUMNS(__Table,"Value",[__Value]), __ValuesToFind),[Value],",")
RETURN
__Result