Forum Discussion
DAX Help: Find partial match in another column to create a new column
- 3 years ago
and try this cod in DAX
Chad,
I apologize, the first DAX snippet I gave you is wrong. I sent it off the top of my head and flipped the arguments around.
CONTAINSSTRING( ) works like this (text you want to search, text you want to find).
I put your fields in backwards, which is why it's not finding the values with multiple people, since that string is made of multiple members.
Try flipping the arguments around inside the parentheses.
IF(CONTAINSSTRING([Group Members], [Ticket Creator), "Member", "Non-Member")
Again, sorry for the confusion.
Thanks,
JTB
JTBusinessIntell This helped, but maybe I was not very clear in my question. Using my example above, "Mouse, Micky" is being labeled as a "Member" but another row that includes "McQueen, Lightning" as the ticket creator and the same Group Members, still lists them as a "Non-Member". Myappologiess for not making that clear from the start.
- JTBusinessIntel3 years ago
Helper I
Chad,
As long as your substring matches the same spelling and format as the search value, you should be returning a match for the value in the ticket creator column.
I'm assuming that there is another row that is set up for McQueen, Lightning that's not returning a "member" result?
Is the formatting between the two columns the same? Is his name "McQueen, Lightning" in both?
The only thing I can think of is that potentially the name in the Ticket Creator <> the name in the Group Members, and as such, the substring is not recognized when the expression evaluates those records.- chadnelson3 years ago
Helper I
Yes, I have another row where "McQueen, Lightning" is listed as the Ticket Creator and the Group Members column still lists members in the same order as the row where "Mouse, Mickey" is the Ticket Creator. Spelling is exactly the same for all names in both columns, but text/value is not exactly the same because the Group Members column also lists the group member's institutional affiliation inside parenthesis.
- JTBusinessIntel3 years ago
Helper I
Chad,
As long as the spelling is the same, I cannot think of why the value would not return for the second member of the group.
The only last thing I can think might work is possibly passing wildcards into the search value. I've not done this in application and don't have a good data source to test it for your use case, but your code would ideally look something like this:Membership = var search_value = "*" & [Ticket Creator] & "*" var return_value = IF(CONTAINSSTRING([Group Members], search_value ), "Member", "Non-Member") return return_valuehopefully the inclusion of the wildcards works with a dynamic list of members in the Ticket Creator column.
I hope that works!