Hi All,
I've a input data like below and summarizing at ID,Code level.

Below is the expected output.

Logic here is
if at ID level, if we have 2 different codes then Mark them as Flag1
if at ID level, if code = 'AA' then Flag2
else Flag3
Can you please help me in achieving this ?