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
Anonymous
Not applicable

DAX Assistance: How to Reference another Row with Duplicate Value

Hi, 

 

Urgent help required please if possible. I've attempted to find solution myself for hoursss, but not been able to. 

 

I have two columns in Power BI, which I will use to create a new column for my desired output (Move Type column). 

Column 1 (Type)

Column 2 (Delivery Number)

 

Desired Output (Move Type column) 

Delivery NumberTypeNew Move TypeDuplicate?
305865793LargeLarge & CasesTrue
305865793CasesLarge & CasesTrue
305865791LargeLargeFalse
305865757CasesCasesFalse
305865753LargeLarge & CasesTrue
305865753CasesLarge & CasesTrue
305865726LargeLarge & CasesTrue
305865726CasesLarge & CasesTrue
305865718LargeLarge & CasesTrue
305865718CasesLarge & CasesTrue
305865716LargeLargeFalse
305865715LargeLarge & CasesTrue
305865715CasesLarge & CasesTrue
305865676LargeLarge & CasesTrue
305865676CasesLarge & CasesTrue
305865669LargeLarge & CasesTrue
305865669CasesLarge & CasesTrue
305865647LargeLargeFalse
305865635LargeLarge & CasesTrue
305865635CasesLarge & CasesTrue
305865197LargeLargeFalse

 

IF [Delivery Number] is a duplicate, then I want to check the [Type] for all those individual duplicate Delivery Numbers

IF any of the [Type] for the duplicate Delivery Numbers is "Cases", then I want the [New Type] to return "Large & Cases" for all those Delivery Numbers. 

 

Unfortunately, I see no option to upload PBIX file

 

Thanks in advance

Matt

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

Those are for creating new columns.

 

Untitled.png

 

New Move Type CC = 
CONCATENATEX (
    FILTER ( data, Data[Delivery Number] = EARLIER ( Data[Delivery Number] ) ),
    Data[Type],
    " & ",
    Data[Type], DESC
)

 

Duplicate CC = 
COUNTROWS (
    SUMMARIZE (
        FILTER ( data, Data[Delivery Number] = EARLIER ( Data[Delivery Number] ) ),
        Data[Type]
    )
) <> 1

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Anonymous
Not applicable

This is exactly what I was looking for. Thank you so much

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

Those are for creating new columns.

 

Untitled.png

 

New Move Type CC = 
CONCATENATEX (
    FILTER ( data, Data[Delivery Number] = EARLIER ( Data[Delivery Number] ) ),
    Data[Type],
    " & ",
    Data[Type], DESC
)

 

Duplicate CC = 
COUNTROWS (
    SUMMARIZE (
        FILTER ( data, Data[Delivery Number] = EARLIER ( Data[Delivery Number] ) ),
        Data[Type]
    )
) <> 1

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


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.