Count bundles, then get percentage of total that share a specific attribute

Hi,
I want to pull a list of tasks from clickup, then see how many tasks are in that list. Then see how many are marked with a status of “done”. Then use that info to create a percentage of the tasks that are marked done. Then I want to add that info to a different task in a custom felid.

I can pull the list, and I get a json that has about 30 that look something like this:

{
    "id": "86880ad2b",
    "custom_id": null,
    "custom_item_id": 0,
    "name": "Event Lead: Provide Julie N with speaker headshot & bio if it needs to be added to or updated in Craft",
    "text_content": "",
    "description": "",
    "status": {
        "status": "Open",
        "color": "#87909e",
        "type": "open",
        "orderindex": 0
    },
    "orderindex": "39912438.00018550000000000000000000000000",
    "date_created": "2024-03-26T16:35:05.908Z",
    "date_updated": "2024-04-02T16:22:15.611Z",
    "date_closed": null,
    "date_done": null,
    "archived": false,
    "creator": {
        "id": 38124170,
        "username": "REDACTED",
        "color": "#388d3c",
        "email": "REDACTED",
        "profilePicture": null
    },
    "assignees": [],
    "group_assignees": [],
    "watchers": [
        {
            "id": 4457878,
            "username": "REDACTED",
            "color": "#f42c2c",
            "initials": "MB",
            "email": "REDACTED",
            "profilePicture": null
        },
        {
            "id": 38124170,
            "username": "REDACTED",
            "color": "#388d3c",
            "initials": "JN",
            "email": "REDACTED",
            "profilePicture": null
        }
    ],
    "checklists": [],
    "tags": [
        {
            "name": "p2p test",
            "tag_fg": "#8077F1",
            "tag_bg": "#8077F1",
            "creator": 4457878
        }
    ],
    "parent": null,
    "priority": null,
    "due_date": "2024-10-21T08:00:00.000Z",
    "start_date": null,
    "points": null,
    "time_estimate": 0,
    "custom_fields": {},
    "dependencies": [],
    "linked_tasks": [],
    "locations": [],
    "team_id": "2335315",
    "url": "https://app.clickup.com/t/86880ad2b",
    "sharing": {
        "public": false,
        "public_share_expires_on": null,
        "public_fields": [
            "assignees",
            "priority",
            "due_date",
            "content",
            "comments",
            "attachments",
            "customFields",
            "subtasks",
            "tags",
            "checklists",
            "coverimage"
        ],
        "token": null,
        "seo_optimized": false
    },
    "permission_level": "create",
    "list": {
        "id": "901103158004",
        "name": "TEST: P2P ROUNDTABLE",
        "access": true
    },
    "project": {
        "id": "90111607417",
        "name": "Peer to Peer Event Templates",
        "hidden": false,
        "access": true
    },
    "folder": {
        "id": "90111607417",
        "name": "Peer to Peer Event Templates",
        "hidden": false,
        "access": true
    },
    "space": {
        "id": "90110681001"
    },
    "custom_fields_original": [
        {
            "id": "412d9c94-278d-4473-9598-08d748a58ce9",
            "name": "MemberId",
            "type": "short_text",
            "type_config": {},
            "date_created": "2024-04-01T17:38:32.854Z",
            "hide_from_guests": false,
            "required": false
        }
    ],
    "__IMTLENGTH__": 31,
    "__IMTINDEX__": 1
},

I Think I have to use and Array aggregator, to group them into bundles that have different statuses. I can do that, but at that point I don’t know what do do next.

Welcome to the Make community!

Your example does not provide an example of a “done” item.

What field are you aggregating by to get that output?

2 Likes

Sorry, Im new.

Im aggregating by Total number of bundles.
I am grouping by Status: Status

Since they are grouped (into multiple bundles), now you need a second array aggregator after the current one.

  • Set the source module to the ClickUp trigger module.

  • Select the properties “Key” and “Array”.

Can you put that in and see what output bundle you get?

2 Likes

Ok, now I have this:

[
    {
        "array": [
            {
                "array": [
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    },
                    {
                        "__IMTLENGTH__": 31
                    }
                ],
                "__IMTKEY__": "Open"
            },
            {
                "array": [
                    {
                        "__IMTLENGTH__": 31
                    }
                ],
                "__IMTKEY__": "done"
            },
            {
                "array": [
                    {
                        "__IMTLENGTH__": 31
                    }
                ],
                "__IMTKEY__": "in progress"
            },
            {
                "array": [
                    {
                        "__IMTLENGTH__": 31
                    }
                ],
                "__IMTKEY__": "review"
            }
        ],
        "__IMTAGGLENGTH__": 4
    }
]

That doesn’t seem right, if done correctly, each sub-array should have the grouped items from the first aggregator, which you can then use the built-in function length on them to get the number of items in each group.

You need to expand those arrays to see what’s going on in there.

2 Likes