Forum Discussion
String block search
- 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
In Power Query, you can split the column by number of characters (repeatedly).
Now you can search for the string in each column (if TextColumn.1 = "abc" or TextColumn.2 = "abc"...).
- Wresen5 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
- DataInsights5 years agoSuper User