Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
I have a dataset that contains users in and all users. I want to be able to compare these columns and return a column that shows users that are in
Expected Result:
Solved! Go to Solution.
@Anonymous solely with a dax measure.
_missingValues =
VAR _1 =
ADDCOLUMNS ( 'Table', "_allUsers", SUBSTITUTE ( 'Table'[All Users], ",", "|" ) )
VAR _2 =
GENERATE (
_1,
ADDCOLUMNS (
GENERATESERIES ( 1, PATHLENGTH ( [_allUsers] ) ),
"Words", PATHITEM ( [_allUsers], [Value], TEXT )
)
)
RETURN
CONCATENATEX (
FILTER (
_2,
[Users off] <> [Words]
&& CONTAINSSTRING ( [Users off], [Words] ) = FALSE ()
),
[Words],
",",
[Words]
)
And a calculated column
Column =
VAR _1 =
ADDCOLUMNS ( 'Table', "_allUsers", SUBSTITUTE ( 'Table'[All Users], ",", "|" ) )
VAR _2 =
GENERATE (
_1,
ADDCOLUMNS (
GENERATESERIES ( 1, PATHLENGTH ( [_allUsers] ) ),
"Words", PATHITEM ( [_allUsers], [Value], TEXT )
)
)
RETURN
CONCATENATEX (
FILTER (
_2,
[Users off] <> [Words]
&& CONTAINSSTRING ( [Users off], [Words] ) = FALSE ()&&'Table'[Index]=EARLIER([Index])
),
[Words],
",",
[Words]
)
PBIX is attached
@Anonymous solely with a dax measure.
_missingValues =
VAR _1 =
ADDCOLUMNS ( 'Table', "_allUsers", SUBSTITUTE ( 'Table'[All Users], ",", "|" ) )
VAR _2 =
GENERATE (
_1,
ADDCOLUMNS (
GENERATESERIES ( 1, PATHLENGTH ( [_allUsers] ) ),
"Words", PATHITEM ( [_allUsers], [Value], TEXT )
)
)
RETURN
CONCATENATEX (
FILTER (
_2,
[Users off] <> [Words]
&& CONTAINSSTRING ( [Users off], [Words] ) = FALSE ()
),
[Words],
",",
[Words]
)
And a calculated column
Column =
VAR _1 =
ADDCOLUMNS ( 'Table', "_allUsers", SUBSTITUTE ( 'Table'[All Users], ",", "|" ) )
VAR _2 =
GENERATE (
_1,
ADDCOLUMNS (
GENERATESERIES ( 1, PATHLENGTH ( [_allUsers] ) ),
"Words", PATHITEM ( [_allUsers], [Value], TEXT )
)
)
RETURN
CONCATENATEX (
FILTER (
_2,
[Users off] <> [Words]
&& CONTAINSSTRING ( [Users off], [Words] ) = FALSE ()&&'Table'[Index]=EARLIER([Index])
),
[Words],
",",
[Words]
)
PBIX is attached
@Anonymous did you try the above?
Hi @amitchandak sorry my current columns are via a DAX Column. Therefore this would need to be done in DAX
Hi @Anonymous ,
Agree with @ amitchandak, it is better to use Power Query to achieve it because the string comparison is strictly defined in DAX and split columns is too complex.
Since the two user columns have been created by DAX, you can consider using the simliar logic to create them in Power Query first and refer this simliar thread to compare string columns to find the difference in Power Query:
Comparing String in two columns for differences
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 40 | |
| 38 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 34 | |
| 33 | |
| 30 |