I have created a summary table in Power BI using the following DAX expression:
NewTable =
SUMMARIZECOLUMNS (
all_apps_acc_tran[appl_appl_no],
all_apps_acc_tran[appl_origin_code_basic],
FILTER (
all_apps_acc_tran,
all_apps_acc_tran[table_type] = "APPS"
)
)
This works fine, however I noticed that in the appl_appl_no column I have duplicate values because one application number could have two origin codes. I tried using the following expression as a new column, however it's showing all occurrences as "Duplicate":
DuplicateFlag =
IF (
COUNTROWS (
FILTER (
NewTable,
NewTable[appl_appl_no] = EARLIER ( NewTable[appl_appl_no] )
)
) > 1,
"Duplicate",
"Not Duplicate"
)
Is there a way, in the NewTable expression to keep the first instance of the duplicate value, but eliminate the rest, or for the column expression to show "Not Duplicate" on the first occurrence?
If possible, it can base the "rule" that when a duplicate is found in the original table, all_apps_acc_tran, it can use the value with the most recent all_apps_acc_tran[decision_date].
Try this variation:
NewTable =
SUMMARIZECOLUMNS (
all_apps_acc_tran[appl_appl_no],
FILTER (
all_apps_acc_tran,
all_apps_acc_tran[table_type] = "APPS"
),
"appl_origin_code_basic",
MINX(
TOPN(1, all_apps_acc_tran, [decision_date], DESC),
[appl_origin_code_basic]
)
)