Dear all,

Please take a look at the attached dummy dataset screenshot. How do I generate a variable "Number" which tells me the number of colours per district? For example, for district A, Number should be 2, as there are 2 colours - BLUE and PINK. Similarly, for District B, Number should be 3, as there are 3 colours overall - BLUE, PINK and RED.

The actual dataset has way more colours and districts than just a few.

Thanks in advance!