Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Compare Names between two columns and return difference

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 

 

dandan123456_1-1636719600666.png

 

Expected Result:

 

dandan123456_2-1636719645061.png

 

 

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@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]
    )

 

 

smpa01_0-1637030348389.png

 

And a calculated column

 

smpa01_1-1637030772601.png

 

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

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

5 REPLIES 5
smpa01
Super User
Super User

@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]
    )

 

 

smpa01_0-1637030348389.png

 

And a calculated column

 

smpa01_1-1637030772601.png

 

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

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

@Anonymous did you try the above?

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
amitchandak
Super User
Super User

@Anonymous , A new column in power query

 

List.RemoveItems(Text.Split([All User],","),Text.Split([All User],","))

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

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.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors