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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Cobra77
Post Patron
Post Patron

how find the "same row" with a different value ?

Hi ,

how find the "same row" with a different value ?

I explain :

How to find in a table lines which have the same employee id, the same name, the same date of birth but a different company  where is Active for example ?

Cobra77_0-1593603775579.png

In this example the employee Test with the same date of birth , has 2 different companies.

Its a bug.

 

and the best way to show this?

 

thanks a lot

 

4 REPLIES 4
AntrikshSharma
Community Champion
Community Champion

Try something like this, in my table color, brand, and Stock type are the column of the Products table, replace these with your table and columns and if you want to add logic then you can create a new variable that refers to the column in the table and use it inside the FILTER function. 

SameSame = 
VAR OuterProductColor = Products[Color]
VAR OuterProductBrand = Products[Brand]
VAR OuterProductStock = Products[Stock Type]
VAR ProductsWithSameDetails =
    FILTER (
        Products,
        Products[Color] = OuterProductColor
            && Products[Brand] = OuterProductBrand
            && Products[Stock Type] = OuterProductStock
    )
VAR CountOfSameProducts =
    COUNTROWS ( ProductsWithSameDetails )
RETURN
    CountOfSameProducts

If you don't prefer variables then you can use EARLIER, but variables help in readability, the purpose of variables and EARLIER is to distinguish between the column of the products inside the FILTER function and columns in the table and the Row context created by the calculated column on the product table and row context created by FILTER function.

SameSame =
VAR ProductsWithSameDetails =
    FILTER (
        Products,
        Products[Color] = EARLIER ( Products[Color] )
            && Products[Brand] = EARLIER ( Products[Brand] )
            && Products[Stock Type] = EARLIER ( Products[Stock Type] )
    )
VAR CountOfSameProducts =
    COUNTROWS ( ProductsWithSameDetails )
RETURN
    CountOfSameProducts

 

amitchandak
Super User
Super User

@Cobra77 , this will give count based on match condition

countx(filter(Table,[emp id] =earlier([emp id]) && [name] =earlier([name]) && [Birthday] =earlier([Birthday])
&& [status] =earlier(status) && [status] =1),[emp id])

rows having count>0 are duplicate

Hi @amitchandak ,

thansk for your answer

 

in reality in my table I have 50 columns and I especially want to do the test on 3-4 identical columns and which have a different company

 

I try with this measure in a filtered table on the indicator and a table which gives me the detail after having clicked on the 1st it seems to work.

 

duplicate.jpg

Hi @Cobra77 

 

Do you still have issues with this?

If you've fixed the issue on your own please kindly share your solution. If any of the above posts helped, please kindly mark it as a solution to help others find it more quickly. Thanks!

Cheers,
Sturla

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.