Forum Discussion
How to extract continuous string set from a column with multiple criteria
- 5 years ago
Anonymous - OK, I updated this with a Client Name output version and Project output version in 2 additional columns. I checked the matches, don't see anything obviously amiss. Solved?
PBIX is attached.
Anonymous Except it doesn't work that way. To implement the original algorithm in DAX I had to do this:
Let's take just the first 2 client names
| 1 | Aaron's |
| 2 | ABB (CA VDA) |
In order to emulate looping, which is impossible in DAX, this becomes:
| 1 | 1 | A |
| 1 | 2 | Aa |
| 1 | 3 | Aar |
| 1 | 4 | Aaro |
| 1 | 5 | Aaron |
| 1 | 6 | Aaron' |
| 1 | 7 | Aaron's |
| 2 | 1 | A |
| 2 | 2 | AB |
| 2 | 3 | ABB |
and so on, the entire list of projects gets blown out into a big table like this. Then, I go about adding a column to this table that says whether it matches the client or not, basically a 1 or a 0. Then, I filter out the zeros. Then I grab the MAX of the second column, that is my longest match.
This is looping in DAX.
So, explain again how your logic fits into this?
Steelwave is a Client Name and it matches Sterling up until 3 characters. The only match returned is Sterling, not Sterling and Steelwave because Steelwave is not an Ongoing Project name. So, you are left with Steelwave matching Sterling up until Ste. You can lower the thresholds but then you start running into issues with Dell, etc.
Greg_DecklerYou are right. My logic has some flaws in case where the Project name does not appear in the client list