I've been trying to find a suitable answer to my problem but couldn't do it.
I have a large dataset that looks similar to this sample. In this image you can see different employees that have a duplicate expense amount in different reports or in the same report. In the case of the first employee, he has two duplicates for the same amount, one on each report. The Spanish employee and the Mexican one have the same duplicate amount twice on the same report.
I would like to be able to highlight the records that meet this condition: whether the duplicate amount is in one report or in two different reports:
Is it possible? Can someone help me? Thank you.
Try a measure like:
DuplicateType =
var emp = SELECTEDVALUE(Expenses[employee])
var amt = SELECTEDVALUE(Expenses[amount])
var rid = SELECTEDVALUE(Expenses[report_id])
var countDifferentReports = CALCULATE(COUNTROWS(Expenses), ALLSELECTED(Expenses), Expenses[employee] = emp && Expenses[amount] = amt && Expenses[report_id] <> rid)
var countSameReports = CALCULATE(COUNTROWS(Expenses), ALLSELECTED(Expenses), Expenses[employee] = emp && Expenses[amount] = amt && Expenses[report_id] = rid)
return SWITCH(TRUE(),
countDifferentReports > 0 && countSameReports > 1, "D+S",
countDifferentReports > 0, "D",
countSameReports > 1, "S"
)
Then for your conditional formatting have something like:
D = Different Report
S = Same Report
D+S = Different and Same Report (edge case maybe)