How to add a count function to measures