Sort Groups by Date in Tasks Query?

I am currently trying to perfect my workflow and I’m trying to make an archive of completed tasks that groups tasks by their completed date. I’ve been able to get as far as a grouped list, but the groups are sorted in chronological order instead of reverse chronological order (aka, most recent date’s completed tasks at the top of the list). Does anyone know how to achieve this with the tasks plugin? Here’s what my query looks like right now:

done
tags include #Task/Work 
description does not include ❌
group by done
sort by done

I tried adding reverse to the sort and it did’t do anything.

According to this, Redirecting…, having sort by done reverse should do the trick. If it doesn’t, then maybe you need to update the plugin, or check if your query has other errors.

You could also try some other query, and reverse that, just to check your syntax, or even check the console in developer tools.

What’s the format of the done field, how do the query output look like now?

Bonus tip: When including code block queries in a post, surround it by code fences with more than three backticks, like use ```` before and after.

The grouping feature doesn’t behave that way, it seems. When you include sort by done reverse without grouping, like this:

```tasks
done
tags include #Task/Work 
description does not include ❌
sort by done reverse
```

… it works as you would expect. But when you add grouping, like this:

```tasks
done
tags include #Task/Work 
description does not include ❌
sort by done reverse
group by done
```

… it sorts the groups in chronological order.

I tried taking the reverse property off of the due date sort and adding it to the grouping line, like this:

```tasks
done
tags include #Task/Work 
description does not include ❌
group by done reverse
```

Also tried:

```tasks
done
tags include #Task/Work 
description does not include ❌
group by done
sort by done reverse
```

But the groups sort in chronological order no matter what.

My plugin is up to date, so I’m thinking maybe this functionality isn’t baked into the plugin.

I’m not using this plugin, so not easily testable, but it should be doable, and it’s kind of strange that it doesn’t work.

Have you tried the superfluous variant of sorting both in front and after the group by statement? Something like:

```tasks
done
tags include #Task/Work 
description does not include ❌
sort by done reverse
group by done
sort by done reverse
```

If you don’t get it to work, I’d strongly suggest going to the github page of the plugin, and ask either in discussions or issues why this doesn’t work.

1 Like

No dice, unfortunately.

Thanks so much for your suggestions though! I’ll be sure to head over to the GitHub page and ask about this quirk. :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.