Forum Discussion
DAX Help: Find partial match in another column to create a new column
- 2 years ago
and try this cod in DAX
Hey Chad,
Try creating a custom column with this:
Membership =
IF(CONTAINSSTRING([Ticket Creator], [Group Members]), "Member", "Non-Member")
As long as the name formatting is consistent between the two columns you should be alright to use this.
Let me know if you have any questions!
Best,
JTB
JTBusinessIntel I have gotten the DAX to work for all instances except for those rows that have multiple members of the group. Those are all being labeled as non-member.
- JTBusinessIntel2 years ago
Helper I
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- chadnelson2 years ago
Helper I
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.
- JTBusinessIntel2 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.