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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Check duplicate in another table

Hello guys,

 

I'm trying to create a custom column in my 'investigation' table. I want that this new column tells me if there are some duplicates ERP number in my 'source' table matching with ERP number in my 'investigation' table. How can i do that ?

 

Best regards,

 

ScrappyS

1 ACCEPTED SOLUTION
edhans
Community Champion
Community Champion

See this formula:

    #"Add Duplicate Check" = 
        Table.AddColumn(
            #"Changed Type",
            "Duplicate Check",
            each
            let 
                varCode = [Code],
                varColor = [Color]
            in
            if Table.RowCount(
                Table.SelectRows(
                    #"Source Table", each [Code] = varCode and [Color] = varColor
                )
            ) > 1 
            then true
            else false,
            type logical
        )

My PBIX file is here. It looks in this table:

2020-06-15 09_59_23-20200615 - Look for Duplicates in Another Table - Power Query Editor.png

and finds duplicates as shown:

2020-06-15 09_59_00-20200615 - Look for Duplicates in Another Table - Power Query Editor.png

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

7 REPLIES 7
edhans
Community Champion
Community Champion

The following formula will tell you if the Code in your current table exists in the Code column of the Source Table.

 

List.Contains(#"Source Table"[Code], [Code])

 

You can see my sample PBIX file here

If you need further help, please provide actual data.

 

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

Hello Edhans,

 

Thanks for the answer, but how can i get only the ones in 'source' [code] with an occurence > 1 AND match to my 'investigate'[code] ?

 

Best regards,

 

ScrappyS

 

edhans
Community Champion
Community Champion

again, provide sample data, with some examples of expected output. Please don't expect us to come up with sample data. Then we get it wrong, which is what I did with my first try.

 

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

My bad, i can't provide pbix file for now but maybe with this schema, it will be more precise :

2020-06-15 18_02_33-Classeur1 - Excel.png

 

Thank you very much !

edhans
Community Champion
Community Champion

See this formula:

    #"Add Duplicate Check" = 
        Table.AddColumn(
            #"Changed Type",
            "Duplicate Check",
            each
            let 
                varCode = [Code],
                varColor = [Color]
            in
            if Table.RowCount(
                Table.SelectRows(
                    #"Source Table", each [Code] = varCode and [Color] = varColor
                )
            ) > 1 
            then true
            else false,
            type logical
        )

My PBIX file is here. It looks in this table:

2020-06-15 09_59_23-20200615 - Look for Duplicates in Another Table - Power Query Editor.png

and finds duplicates as shown:

2020-06-15 09_59_00-20200615 - Look for Duplicates in Another Table - Power Query Editor.png

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

Thanks a lot, it worked like a charm !

edhans
Community Champion
Community Champion

Great @Anonymous . Glad to help out.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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