Forum Discussion
Anonymous
4 years agoNot applicable
Conditional deduplication based on multiple columns
Hi everyone, I need to write a very specific deduplication query and I am wondering if you can help me out. We have an ecommerce site and I am getting a daily CSV file that has transactional info...
- Anonymous4 years ago
Hi Anonymous
Try this code.
Remove Duplicate = SUMMARIZE ( FILTER ( 'Table', IF ( VAR _COUNTROW = CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( ALL ( 'Table' ), 'Table'[Master Order Number] = EARLIER ( 'Table'[Master Order Number] ) && 'Table'[Item ID] = EARLIER ( 'Table'[Item ID] ) ) ) RETURN _COUNTROW > 1, 'Table'[RANK] <> 1 || 'Table'[Invoice Date] <> BLANK (), 'Table'[RANK] = 1 ) ), 'Table'[Order Number], 'Table'[Master Order Number], 'Table'[Order Date], 'Table'[Invoice Date], 'Table'[Item ID] )Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
4 years agoNot applicable
Hi Anonymous
Try this code.
Remove Duplicate =
SUMMARIZE (
FILTER (
'Table',
IF (
VAR _COUNTROW =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALL ( 'Table' ),
'Table'[Master Order Number] = EARLIER ( 'Table'[Master Order Number] )
&& 'Table'[Item ID] = EARLIER ( 'Table'[Item ID] )
)
)
RETURN
_COUNTROW > 1,
'Table'[RANK] <> 1
|| 'Table'[Invoice Date] <> BLANK (),
'Table'[RANK] = 1
)
),
'Table'[Order Number],
'Table'[Master Order Number],
'Table'[Order Date],
'Table'[Invoice Date],
'Table'[Item ID]
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
4 years agoNot applicable
Thank you very much Anonymous this has done the trick. Appreciate your expertise and assistance.