Forum Discussion
toum
3 years agoHelper II
Matche DAX
Hello,
Could you pleaqe tell me how I can convert this code to DAX
SEARCH("^[A-Za-z]{5}@[0-9]{2} .*", [Column], , , , 1) = 1, TRUE(), FALSE())
Here is a DAX solution using "DAX loops :D"
VAR textNew = UPPER('Table'[Column1])VAR alphabet = SELECTCOLUMNS(GENERATESERIES(UNICODE("A"), UNICODE("Z")), "@Char", UNICHAR([Value]))VAR numbers = SELECTCOLUMNS(GENERATESERIES(0, 9, 1), "@Char", [Value])VAR characters = UNION(alphabet, numbers, ROW("@Char", "@"))VAR textLength = LEN(textNew)VAR numTable = SELECTCOLUMNS(GENERATESERIES(1, textLength, 1), "@Num", [Value])VAR charTable = ADDCOLUMNS(numTable, "@Char", MID(textNew, [@Num], 1))VAR checkTable =ADDCOLUMNS(charTable,"@Check",IF([@Char] IN characters, 0, 1))VAR countValues = SUMX(checkTable, [@Check])RETURN {IF(countValues > 0, TRUE())}
Screenshot has the formula with commnets:
5 Replies
- YukiKImpactful Individual
You can use Python or R integration. https://community.powerbi.com/t5/Desktop/What-is-the-equivalent-in-REGEX-for-DAX/td-p/2303562
- toumHelper II
I can not use power query I have to use dax
- PawelWronaResolver II
Here is a DAX solution using "DAX loops :D"
VAR textNew = UPPER('Table'[Column1])VAR alphabet = SELECTCOLUMNS(GENERATESERIES(UNICODE("A"), UNICODE("Z")), "@Char", UNICHAR([Value]))VAR numbers = SELECTCOLUMNS(GENERATESERIES(0, 9, 1), "@Char", [Value])VAR characters = UNION(alphabet, numbers, ROW("@Char", "@"))VAR textLength = LEN(textNew)VAR numTable = SELECTCOLUMNS(GENERATESERIES(1, textLength, 1), "@Num", [Value])VAR charTable = ADDCOLUMNS(numTable, "@Char", MID(textNew, [@Num], 1))VAR checkTable =ADDCOLUMNS(charTable,"@Check",IF([@Char] IN characters, 0, 1))VAR countValues = SUMX(checkTable, [@Check])RETURN {IF(countValues > 0, TRUE())}
Screenshot has the formula with commnets:- toumHelper II
Can you send me the pbix please
- PawelWronaResolver II
Sure, here it is 🙂
https://drive.google.com/file/d/1ExioyflVzkMhcxArrW0O2-Ia7_Y0sop8/view?usp=share_link