Forum Discussion
Wresen
5 years agoPost Patron
String block search
Hi and thanks for reading this. Have tried to find an answer for this but no luck. Is it possible to do a textsearch that search in blocks of every 3 letter in a string. Lets say i am lookin...
- 5 years ago
Hey Wresen ,
first I created a table that contains the "predefined blocks", I called this table "searchstrings" and the column "searchstring", the table looks like this:
The table is NOT related to the item-table.
Then I created this measure:
Measure = var __SearchstringsToFind = VALUES( 'Searchstrings'[searchstring] ) var lengthOfBlock = 3 return COUNTX( Sheet1 , var afunnystring = 'Sheet1'[String] var lengthofstring = LEN( afunnystring ) var noofoccurrences = IF( MOD( lengthofstring , lengthOfBlock ) = 0 , INT( DIVIDE( lengthofstring , lengthOfBlock ) ) , INT( DIVIDE( lengthofstring , lengthOfBlock ) ) + 1 ) var __blocks = ADDCOLUMNS( GENERATESERIES( 1 , noofoccurrences ) , "block" , MID( afunnystring , ''[Value] * lengthOfBlock - 2 , lengthOfBlock ) ) return COUNTROWS( FILTER( __blocks , [block] in __SearchstringsToFind ) ) )It seems the measure is returning the expected result:
Hopefully, this provides what you are looking for.
Regards,
Tom
Wresen
5 years agoPost Patron
Hi DataInsights
Thanks so much , but the problem is that string is VERY big so i belive it will not be good to spilt it up in a colum for each string.
Also in the long run my thougt is to be able to do a filtersearch for some of these sting of 3 letters.
/thanks
DataInsights
5 years agoSuper User