Hello everybody
I have a small problem concerning a group by in my Dataview Query.
I have a bunch of Notes in the “Finance/Spending” Folder.
All Notes in there have the Properties:
- Cost::
- Active::
- Interval::
Interval can contain the Values “Monthly” or a number from 1 to 12 if the spending only occurs in a specific month.
Now I tried to write a Query that would sum all my spendings for individual months in a column.
I started with the January Column which would look like this:
TABLE
sum(
choice(
Interval = "Monthly", rows.Cost, choice(
contains(Interval, 1), rows.cost, 0)
)
) as January
FROM "Finance/Spending"
WHERE Active = true
GROUP BY Active
The problem is that I only get 0 as the Final Sum.
I then tried to simplify the Query to see where exactly the problem is.
If I leave out the group by I get a list of all my spending with the correct costs, if I leave out the choice I can create a sum.
So my guess here is that the group by needs the “rows.” to recognize the array to sum. But because of the choice function, I can’t tell it that the result is the array to sum
It would be great if somebody could help me with this. I’m still new to Dataview.
Lots of Thanks