Forum Discussion
TcT85
3 years agoHelper III
Distinct count with multiple filters
Hi I been trying different solutions for this topic but I can't get it to work. I need to distinct count the barcode with 2 filters and that is "FalseCall" from OperatorJudgement and "Acceptable...
- 3 years ago
Hi TcT85 ,
When the DISTINCTCOUNT() function finds no rows to count, it returns a BLANK, otherwise it returns the count of distinct values.
So if you want the both filter to be true and not return blank value, please try:
Distinctcount = CALCULATE( DISTINCTCOUNT('SPC DATA'[Barcode]),'SPC DATA'[OperatorJudgement] = "falsecall", 'SPC DATA'[OperatorNgType] = "Acceptable")+0Output:
If you just want to calculate the barcode with "FalseCall" and "Acceptable" instead of requiring both values on the same line, please try:
Distinctcount2 = VAR _a = SUMMARIZE ( 'SPC DATA', [Barcode], "Flag", IF ( "FalseCall" IN SELECTCOLUMNS ( FILTER ( 'SPC DATA', [Barcode] = 'SPC DATA'[Barcode] ), "OperationJudgement", [OperatorJudgement] ) && "Acceptable" IN SELECTCOLUMNS ( FILTER ( 'SPC DATA', [Barcode] = 'SPC DATA'[Barcode] ), "OperationNgType", [OperatorNgType] ), 1, 0 ) ) RETURN SUMX ( _a, [Flag] )Output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mario_enrique
2 years agoRegular Visitor
un ejemplo:
= CALCULATE(DISTINCTCOUNT('Estado de OT'[Orden]),FILTER( 'Estado de OT','Estado de OT'[Estado De OT]<> "Cerrada"))