Distinct with custom field

I have tried it that way but I could not make it work.