Forum Discussion
NISH72
6 years agoHelper IV
Conditional calculated column
Hi all I have the following table Id. Name 1. A 1. B 2. C 3. D 4. E If a particular Id has multiple names attached to it.( For eg id 1 has two names at...
- 6 years ago
Hi NISH72 ,
Try this code for a new column:
NewColumn =VAR _result = CALCULATE(COUNT('Table'[Id]); ALLEXCEPT('Table'; 'Table'[Id]))RETURN IF(_result > 1; 1; 0)
camargos88
6 years agoCommunity Champion
Hi NISH72 ,
Try this code for a new column:
NewColumn =
VAR _result = CALCULATE(COUNT('Table'[Id]); ALLEXCEPT('Table'; 'Table'[Id]))
RETURN IF(_result > 1; 1; 0)
- NISH726 years agoHelper IV
When I add this formula in the new column it's throwing syntax error. It's not accepting return if function. Thank you
- camargos886 years agoCommunity Champion
NISH72 ,
Try with comma:
NewColumn =VAR _result = CALCULATE(COUNT('Table'[Id]), ALLEXCEPT('Table', 'Table'[Id]))RETURN IF(_result > 1, 1, 0)- NISH726 years agoHelper IV
The syntax is correct now but still I am not getting desired results. The new column is showing 0 for all rows. Thank you
- mahoneypat6 years agoMicrosoft Employee
Please try this expression for your column
Duplicates = var currentid = 'ID'[Id]var countthisid = COUNTROWS(Filter('ID', 'ID'[Id]=currentid))return if(countthisid>1,1,0)If this works for you, please mark it as solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat