Using your sample data above I have created a table which achieves your outcome. You need to create a table using retest as your group by and retest again as your value but using count as the aggregate. More information is available in the below screenshot:
@PninaBarak were you able to find a solution to this or was @olivia 's comment above helpful? If so could you either post the your solution or mark their comment as the solution to help the community?
My suggestion here would be not to use distinct_countif to achieve this and only use the count function.