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! Learn more

Reply
Anno2019
Helper IV
Helper IV

How to TAG duplicates using a specific criteria and rules

Hi PBI Guru's

Need help please, I know what my logic should be, I know what my result should be, but I am unable to build any formula to show the result I need.
Below is the data set up and three different scenarios. The column named [Primary File Number line TAG] is where I would like to add the formula.
Hope I can get someone to figure this out.

tag duplicates with specific criteria and rules.JPG

2 ACCEPTED SOLUTIONS
v-lili6-msft
Community Support
Community Support

hi, @Anno2019 

You could use this formula to create a new column as below:

Primary File Number line TAG = var countsales=CALCULATE(COUNTA('Table'[Account Owner Role]),FILTER('Table','Table'[File Number]=EARLIER('Table'[File Number])&&'Table'[Account Owner Role]="Sales")) return
var highestinvoice=CALCULATE(MAX('Table'[Invoice Amount]),FILTER('Table','Table'[File Number]=EARLIER('Table'[File Number])&&'Table'[Account Owner Role]="Sales")) return
IF(countsales<>BLANK(),IF('Table'[Invoice Amount]=highestinvoice&&'Table'[Account Owner Role]="Sales","Primary","Ignore"),IF('Table'[Invoice Amount]=CALCULATE(MAX('Table'[Invoice Amount]),FILTER('Table','Table'[File Number]=EARLIER('Table'[File Number]))),"Primary","Ignore"))

Result:

6.JPG

and here is sample pbix file, please try it

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@v-lili6-msft 

You are a legend.  Thank you so much, it works perfectly.

 

If I may ask another question, I might need to open another thread though but in case you can assist I would like to take the chance to ask.

is there anyway that I can add this to the actual query?  I would like to exclude all the "ignore" from my final data table.

is this possible at all.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi, @Anno2019 

You could use this formula to create a new column as below:

Primary File Number line TAG = var countsales=CALCULATE(COUNTA('Table'[Account Owner Role]),FILTER('Table','Table'[File Number]=EARLIER('Table'[File Number])&&'Table'[Account Owner Role]="Sales")) return
var highestinvoice=CALCULATE(MAX('Table'[Invoice Amount]),FILTER('Table','Table'[File Number]=EARLIER('Table'[File Number])&&'Table'[Account Owner Role]="Sales")) return
IF(countsales<>BLANK(),IF('Table'[Invoice Amount]=highestinvoice&&'Table'[Account Owner Role]="Sales","Primary","Ignore"),IF('Table'[Invoice Amount]=CALCULATE(MAX('Table'[Invoice Amount]),FILTER('Table','Table'[File Number]=EARLIER('Table'[File Number]))),"Primary","Ignore"))

Result:

6.JPG

and here is sample pbix file, please try it

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-lili6-msft 

You are a legend.  Thank you so much, it works perfectly.

 

If I may ask another question, I might need to open another thread though but in case you can assist I would like to take the chance to ask.

is there anyway that I can add this to the actual query?  I would like to exclude all the "ignore" from my final data table.

is this possible at all.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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