 
   End date of the workload report.
 
+`:org-ql-match'
+
+  `org-ql' expression (in sexp syntax) to filter the list of tasks.
+
 All tasks between `:start-date' and `:end-date' will be collected
 and their effort summed up.  The date format is everything
 understood by `org-read-date'."
   (let* ((start-date (plist-get params :start-date))
          (end-date (plist-get params :end-date))
-         (task-summary (db/org-planned-tasks-in-range start-date end-date)))
+         (org-ql-match (plist-get params :org-ql-match))
+         (task-summary (db/org-planned-tasks-in-range start-date end-date org-ql-match)))
 
     (insert "| Task | Effort |\n|---|\n")
     (pcase-dolist (`(,task-id . ,effort-string) (cdr task-summary))


;;; Task Management

(defun db/org-planned-tasks-in-range (start-date end-date)
  "Return list of tasks planned between START-DATE and END-DATE.

This function will search through the files returned by

                  :select '(cons
                            (org-id-get-create)
                            (org-entry-get (point) "Effort"))
                  :where `(and ,(or org-ql-match '(todo))
                               ;; Is this redundant?  Could we just stick with `ts-active'?
                               (or (scheduled :from ,start-date :to ,end-date)
                                   (deadline :from ,start-date :to ,end-date)
