Forum Discussion
How to remove duplicate IDs based on applying condition on another Column
Hi Team,
Datawithexpectation
I have below sample table in which i want to remove duplicate ID values based on Status Column ( it has to remove duplicates if exists in ID and it should be of "Non-Complaint" only)
Data here:
| ID | State | Status |
| A1234 | Active | Compliant |
| A1234 | Active | Non-Compliant |
| B1235 | Active | Compliant |
| B1235 | Active | Non-Compliant |
| C12347 | Active | Compliant |
| D12348 | Active | Non-Compliant |
| D12348 | Deactive | Compliant |
| Q12340 | Deactive | Compliant |
| C12342 | Active | Non-Compliant |
| Z21234 | Deactive | Compliant |
i have sample file but i am not able to see any option available to upload it.
Thanks
Santosh
Hi, SantoshKumar
You can try the following methods.
Column = IF ( CALCULATE ( COUNT ( 'Table'[ID] ), FILTER ( 'Table', [ID] = EARLIER ( 'Table'[ID] ) ) ) > 1 && [Status] = "Non-Compliant", 2, 1 )Add the new column to Filters and set it equal to 1.
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- amitchandakSuper User
SantoshKumar , Try a new table like
filter(addcolumns(distinct(Table), "_1", countx(filter(Table, Table[ID] = earlier(Table[ID])),[ID])), [_1] >1 && [status] ="Non-Complaint")
- SantoshKumarMicrosoft Employee
amitchandak i am able to create a new table which provides duplicate data as per my condition.
i have a request here like 1) can we create a new column in the same table instead of new table with value of only [_1] which will have the values such as 1, 2 etc where 1 is value which i am looking out and will exclude values greater than 1 when i want to show the table eliminating duplicate values. can we achieve it? please guide me in this requirement.Thanks
Santosh
- v-zhangtiCommunity Support
Hi, SantoshKumar
You can try the following methods.
Column = IF ( CALCULATE ( COUNT ( 'Table'[ID] ), FILTER ( 'Table', [ID] = EARLIER ( 'Table'[ID] ) ) ) > 1 && [Status] = "Non-Compliant", 2, 1 )Add the new column to Filters and set it equal to 1.
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.