Forum Discussion
rlfRodrigo
2 years agoFrequent Visitor
Find whats different between elements of a string
Im having trouble figuring out how to get it done. Need to find the difference between elements of two strings using DAX A dummy table to ilustrate what i have: What i need on C: ...
- Anonymous2 years ago
Hi,
Thanks for the solution rajendraongole1 provided, and i want to offer some more information for user to rerfer to.
hello rlfRodrigo , you can refer to the following calculated column.
Column = VAR a = SELECTCOLUMNS ( ADDCOLUMNS ( GENERATESERIES ( 1, PATHLENGTH ( [A] ), 1 ), "Value_A", PATHITEM ( [A], [Value] ) ), "ValueA", [Value_A] ) VAR b = SELECTCOLUMNS ( ADDCOLUMNS ( GENERATESERIES ( 1, PATHLENGTH ( [B] ), 1 ), "Value_B", PATHITEM ( [B], [Value] ) ), "ValueB", [Value_B] ) RETURN CONCATENATEX ( EXCEPT ( a, b ), [ValueA], "|" )Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
rajendraongole1
2 years agoSuper User
Hi rlfRodrigo -To find the difference between elements of two strings in DAX and produce
create a below calculated column
Difference =
VAR ListA = SUBSTITUTE(PIPE[A], "|", ",")
VAR ListB = SUBSTITUTE(PIPE[B], "|", ",")
VAR TableA = ADDCOLUMNS(
SELECTCOLUMNS(
GENERATESERIES(1, LEN(ListA)),
"CharA", MID(ListA, [Value], 1)
),
"IsInB", SEARCH([CharA], ListB, 1, 0)
)
VAR Result = CONCATENATEX(
FILTER(TableA, [IsInB] = 0),
[CharA],
"|"
)
RETURN Result
Hope it helps
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!