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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Mark duplicate combined data in relation to another criteria

Hello,

 

Can anyone help with a PBi DAX that will mark the following lines as follows?

 

I need to flag or mark(in column D) each combination of "Number" and "Occurence" that has double entries: one with "N" Flag and one with "Y" Flag.

tyxanu_0-1670330095100.png

If the combination of "Number" and "Occurence" has only 1 entry with "N" Flag, do nothing/flag nothing (PS: It will never happen to have only "Y" flag).

In the end, I need to be able to filter out the data that has this mark.

 

Thank you!

5 ACCEPTED SOLUTIONS
Bifinity_75
Solution Sage
Solution Sage

Hi @Anonymous , try this calculate column:

Target = var rep=CALCULATE(COUNT('Table'[Number]),ALLEXCEPT('Table','Table'[Number]))
var flag_p=CALCULATE(max('Table'[Flag]),ALLEXCEPT('Table','Table'[Number]))
return
if(flag_p="Y" && rep>1,"Mark this","")

 

The result:

Bifinity_75_0-1670331502760.png

 

Best regards

 

View solution in original post

Anonymous
Not applicable

@Bifinity_75 , can you also share a logic that would help me mark all the entries that contain duplicate combination of "Number" and "Occurence" solely? (not considering "Flag")

View solution in original post

Bifinity_75
Solution Sage
Solution Sage

Hi @Anonymous , can you try this:

 

- Create this calculate column:

Numb_Ocurr = 'Table'[Number] & 'Table'[Ocurrence]

 

- Create this another calculate column:

Result = var previous= CALCULATE(COUNT('Table'[Numb_Ocurr]),ALLEXCEPT('Table','Table'[Numb_Ocurr]))
return
if (previous=1,"","Mark this")

 

The result:

Bifinity_75_0-1670438269319.png

 

Best Regards!

 

 

View solution in original post

Hi @Anonymous , create this calculate column:

Target = var rep=CALCULATE(COUNT('Table'[Numb_Ocurr]),ALLEXCEPT('Table','Table'[Numb_Ocurr]))
return
if(CONTAINSSTRING('Table'[Flag],"Yes") && rep>1,"Mark this","") 

 

The result:

Bifinity_75_0-1670612523256.png

 

Best Regards

 

View solution in original post

Bifinity_75
Solution Sage
Solution Sage

Hi @Anonymous, pretty much reducing the logic you've shown me, try with this calculate column:

Target = 
var dupl_comb=CALCULATE(count('Table'[Number]),ALLEXCEPT('Table','Table'[Number],'Table'[Ocurrence]))
return
if('Table'[Flag 1]="N" && 'Table'[Flag 2]="A" || dupl_comb=1 && 'Table'[Flag 1]="N","","Mark this")

The result:

Bifinity_75_0-1671481367941.png

 

Best Regards!

 

 

View solution in original post

9 REPLIES 9
Bifinity_75
Solution Sage
Solution Sage

Hi @Anonymous, pretty much reducing the logic you've shown me, try with this calculate column:

Target = 
var dupl_comb=CALCULATE(count('Table'[Number]),ALLEXCEPT('Table','Table'[Number],'Table'[Ocurrence]))
return
if('Table'[Flag 1]="N" && 'Table'[Flag 2]="A" || dupl_comb=1 && 'Table'[Flag 1]="N","","Mark this")

The result:

Bifinity_75_0-1671481367941.png

 

Best Regards!

 

 

Bifinity_75
Solution Sage
Solution Sage

Hi @Anonymous , try this calculate column:

Target2 = IF (CALCULATE(COUNT('Table'[Numb_Ocurr]),
ALLEXCEPT('Table','Table'[Numb_Ocurr]))>1,"Mark this","")

 

The result:

Bifinity_75_0-1671220198058.png

 

Best Regards

 

 

Anonymous
Not applicable

@Bifinity_75 , can you please help me review this again? Seems that I have not captured all the possible scenarios.

 

a) for each duplicate combination of "Number" and "Occurrence" that has different Flag1= "Y" and "N" -> "Mark This"

b) for each duplicate combination of "Number" and "Occurrence" that has only Flag1="N":

     check if Flag2 = BLANK and if yes -> "Mark This", otherwise

               if Flag2 = "A" -> do nothing

c) for each duplicate combination of "Number" and "Occurrence" that has only Flag1="Y" -> "Mark This"

d) for each unique combinations(no duplicate) of "Number" and "Occurrence":

    if Flag1 = "Y" -> "Mark This", otherwise

    if Flag1 = "N" -> do nothing

 

I have highlighted the scenarios and the desired outcome below :

tyxanu_3-1671186788393.png

Thank you!

 

Anonymous
Not applicable

@Bifinity_75 , can I get your precious help over this new issue? 

Bifinity_75
Solution Sage
Solution Sage

Hi @Anonymous , can you try this:

 

- Create this calculate column:

Numb_Ocurr = 'Table'[Number] & 'Table'[Ocurrence]

 

- Create this another calculate column:

Result = var previous= CALCULATE(COUNT('Table'[Numb_Ocurr]),ALLEXCEPT('Table','Table'[Numb_Ocurr]))
return
if (previous=1,"","Mark this")

 

The result:

Bifinity_75_0-1670438269319.png

 

Best Regards!

 

 

Anonymous
Not applicable

@Bifinity_75 , what about this scenario:

Based on the below picture, can you mark every:

- duplicate combination of "Number" and "Occurence" that has a "Flag" that contains the word "Text Yes" 

and

- don't mark any unique combination of "Number" and "Occurence" that has a "Flag" that contains the word "Text Yes" or no "Flag" at all

tyxanu_0-1670597946876.png

 

 

 

Hi @Anonymous , create this calculate column:

Target = var rep=CALCULATE(COUNT('Table'[Numb_Ocurr]),ALLEXCEPT('Table','Table'[Numb_Ocurr]))
return
if(CONTAINSSTRING('Table'[Flag],"Yes") && rep>1,"Mark this","") 

 

The result:

Bifinity_75_0-1670612523256.png

 

Best Regards

 

Bifinity_75
Solution Sage
Solution Sage

Hi @Anonymous , try this calculate column:

Target = var rep=CALCULATE(COUNT('Table'[Number]),ALLEXCEPT('Table','Table'[Number]))
var flag_p=CALCULATE(max('Table'[Flag]),ALLEXCEPT('Table','Table'[Number]))
return
if(flag_p="Y" && rep>1,"Mark this","")

 

The result:

Bifinity_75_0-1670331502760.png

 

Best regards

 

Anonymous
Not applicable

@Bifinity_75 , can you also share a logic that would help me mark all the entries that contain duplicate combination of "Number" and "Occurence" solely? (not considering "Flag")

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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
Top Kudoed Authors