#+BEGIN_QUERY
{
:title "Total Hours for [Your Month Here]"
:inputs ["2024/11"] ;; Replace with "YYYY/MM" for the target month
:query [
:find (sum ?h)
:in $ ?month-prefix
:where
[?p :block/properties ?props]
[(get ?props :hours) ?h]
[?p :block/journal? true]
[?p :block/journal-day ?d]
;; Convert journal day to a string and check if it contains the month-prefix
[(str ?d) ?date-str]
[(clojure.string/includes? ?date-str ?month-prefix)]
]
:result-transform (fn [result] [(str "Total hours: " (or (first result) 0))])
:table-view? false
}
#+END_QUERY
With the above query, I am trying to accumulate the values of property hours:: from the journal pages of a specific month, but it returns 0 instead of the sum of the integer values.
That’s the correct place for pages. But are they all there? Is there any other difference between the markdown of the working pages and that of the non-working ones? Maybe you could share a screenshot in case we spot any clue. Try also recreating the issue in a new empty graph and compare which days work and which don’t.
I have the hours:: property in 6 journal entries. The total number of November properties is 14.
The series is the following
4
2
2
1
2
3
I observe that the first query sums only the original values, not the duplicate ones. For example, there are three occurrences of the number 2, but it is added only once.