Help getting a count of distinct attributes

Hi

I’m still struggling to get my head around some of the search functionality and get it to return values in the desired format.

I have a pie/donut chart on one of my pages which I want to show a count of each type of user who has attended a particular meeting (in this case, a retrospective).

The chart requires two searches to populate it - one for the labels (the distinct set of Roles of the people who attended) and the other for the data (which should be a count of how many people there were of each Role). The former of these works fine and I get a list of the roles represented. It’s the second one I’m struggling with - I can’t seem to figure out the syntax for returning the counts of each.

In my test dataset I have 4 attendees (two of which are the same role). So in my chart I’m trying to see three distinct roles, one of which has a count of ‘2’ and the others should show ‘1’.

Above the chart I added a basic bit of dynamic text with each search query to try to help with debugging, so I can see what data the chart is getting. The distinct roles are fine, but my counts are always a single value, not a list (clearly I’m getting it wrong in the syntax and it’s counting the distinct roles as a whole). I’ve tried a bunch of things that feel like they might work, but I’m defo at the point of needing some guidance :slight_smile:

Here’s my current config and the resulting chart and dynamic text ‘debuggers’:

Result:

Any help appreciated

Hello,

It appears from the images that you have posted you might just be missing the part where you need to split out the results as comma separated values.

If that doesn’t solve your issue, the count might be in the wrong place (although it’s hard to tell just from the images). See the image below for reference (notice that the count is specified in the group by Aggregation 1 field):

1 Like

Thanks for that - I’ve applied the change and the result is just about there - I’m now getting the list of values back. The only issue left to solve is the ordering, which must be coming through differently for each of the searches (my test dataset has two Delivery Managers, so the chart is currently incorrect due to the order of the values being out of sync with the order of the labels).

Any thoughts on how I’d go about applying an order to these searches?

Glad it helped. The way this chart plugin has been created you do need to be sure and order your lists in the same way for both the labels and values. That means your search clause needs to be exactly the same. The best way to do this is to use the sorted by: statement and pick a column of your choice to sort by, just make sure you use the same sorting column for both. See the image below for syntax help:

Screenshot 2022-05-17 at 5.16.39 PM

1 Like

Phew - finally got there.

I’m sure it’s just a learning curve, but I’m really finding the syntax of these searches quite challenging!

Finally it’s looking right though - thanks so much for the help!

chartEditor3

chartImg3

This topic was automatically closed after 70 days. New replies are no longer allowed.