Grid With Pivot View

i able to generate a pivot view by following the example, but need to count my data instead of sum it up, from the total field i only see there is option for SUM, MIN, MAX but there is no count.Can anyone guide me on how to get the view as i want as attached.

2017-01-09_16-43-57.jpg

you can use php function for count process …

I think SC has that option for count records.

I already tried but can’t find it, perhaps maybe you can guide me on this

Now i manage to get the view as i want by using sql query, the problem now is i created a custom field but i can’t sum it up, i already created a total but it show nothing.

Grid.jpg

Custom Field.jpg