Hi Anna,
Yes, it would be very nice to have a function “countUnique” or some such that returned the number of unique values of an attribute. I’ll add this to the feature request list!
I understand why you might not be a fan of your workaround. 😉 Another workaround you may have thought of is to group by value by moving the value attribute all the way to the left. Now, of course, the count of unique values is the number of rows at that level. If you want a computed count of unique values, you can define an attribute one level higher that counts those rows.
The enclosed screenshot shows the situation using the Roller Coasters example doc.
Bill