Groupby count for chart pie

Hello,
I am building an app where I allow people to create items.
theses items have type (like car, bike etc) and I want to create a pie chart that displays the amount of items a user has grouped by type.
So I created a pie chart element, where the type of data is my item object
the data source is search for items created by the current user
the value expression is "current point’s type:converted to list:count
and the label expression is current point’s type’s Display

Now it almost works but I get a pie slice for each item not by item type. if the user had 4 items, all of which are cats, I’ll get a pie with 4 slices, all named “cats:1” I believe it comes from the value expression which only handles items 1 by 1 because of the current point thing. But I have no other choice than this. I think I would need to work whith the type options but I don’t get how. Does anyone have any idea about this?
Thanks

2 Likes

This question has been posted awhile so I’m not sure if you have solved it.

I think what you need to do is set your Data Source to 'Search for Items :group by ’ and set the field to ‘Items’ with grouping ‘Exact’ (only if the item type are the same i.e. car is car and not Car or CAR) and set aggregation to ‘Count’.

Value Expression would be ‘Current’s point count’

That should get what you need

2 Likes