Forum Discussion
Find duplicates in a column and give a value
- 5 years ago
You can use this in a Calculated Column Anonymous
Duplicates = VAR varCurrentValue = 'Sample'[Column1] VAR varInstances = COUNTROWS( FILTER( 'Sample', 'Sample'[Column1] = varCurrentValue ) ) var Result = IF( varInstances > 1, "Duplicate", "Unique" ) RETURN Result
You don't need ALL or CALCULATE. ALL in this context removes filters. Tables and Calculated Columns have no filter context, only row context. - 4 years ago
You can try this:
Duplicates = VAR varCurrentValue = 'Sample'[Column1] VAR varInstances = COUNTROWS( FILTER( 'Sample', 'Sample'[Column1] = varCurrentValue && NOT 'Sample'[Column1] IN { "House", "Table" } ) ) VAR Result = IF( varInstances > 1, "Duplicate", "Unique" ) RETURN Result
Thanks edhans,
just last question, how would you change the "in" for "contain" to avoid all the words containing "house"?
Thanks very much for your help
I would look at either CONTAINS or CONTAINSTRING
I'd need sample data to work with to test though. You might start a new thread. this one was solved almost a year ago and solved threads get less attention, so it is usually better to start a new thread with good sample data.
How to get good help fast. Help us help you.
How To Ask A Technical Question If you Really Want An Answer
How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.