I tried replacing the if then else with addition of each count function and applied the if condition inside of set analysis but some its not working.
count( distinct < set analysis ( error_type = 'A') project_code ) + count(distinct <set analysis ( error_type = 'B') project code >)
but here it calculating the sum and then applying to all records irrespective of the error type .
e.g. error type A has count --> 5 and Error_type B has count 0
Error Type | Count
even thought B is 0 and no condition exists for type C the output is 5 for all records
Can someone please advice, the aim here is to replace if then else for better performance.
Original Calculation method
if( error_type = 'A', count(<set analysis flag=0 > project_id) , if ( error_type = 'B', count(<set analysis flag=0 >project_id) ,'')
Note : just the simplified version there are more conditions inside