I am trying to get the sum of columns on a table of my Active Projects
Bellow I have the table which I compiled with dataview, might not be the “proper” implementation since I don’t have much experience with it. I am trying to get the sum of the columns.
I’ve seen all other posts and seems like I need to have a secondary table which is fine, I just don’t know how to approach this, how can I retrieve the sum of each column. Closest I’ve been is to replace “GROUP BY Projects” with “GROUP BY Total”, but then I don’t know how to apply the filter that follows, so I get also stats for “non active” projects which defies the purpose of the table as “Active Projects” tracker.
Maybe I am just too much stuck in my head and I can retrieve this information much easier, but yeah at this point I am kind of lost, any help is appreciated.
TABLE WITHOUT ID
regexreplace(Projects,"#MASTER-PROJECT\/(.*)","[MASTER-PROJECT $1](Knowledge%20Hub/3\.%MASTER-PROJECT/Projects/$1)") AS "Project",
length(filter(rows.item, (r) => (r.status != "x" AND r.status != "-"))) AS Pending,
length(filter(rows.item, (r) => (r.status = "x" OR r.status = "-"))) AS Completed,
length(rows.Projects) as Total,
reverse(sort(rows.file.mtime))[0] as "Last Activity",
sort(
nonnull(
filter(
rows.item, (r) => (r.status != "x" AND r.status != "-")
).due
)+nonnull(
filter(
rows.item, (r) => (r.status != "x" AND r.status != "-")
).scheduled
)
)[0] as "Oldest Deadline"
FROM
#MASTER-PROJECT
FLATTEN
file.lists as item
FLATTEN
upper(item.tags) as tag
FLATTEN
tag as Projects
WHERE
item.task AND startswith(tag, "#MASTER-PROJECT")
GROUP BY
Projects
WHERE
length(filter(rows.item, (r) => (r.status != "x" AND r.status != "-")))>0
SORT
sort(nonnull(filter(rows.item, (r) => (r.status != "x" AND r.status != "-")).due))[0] ASC,
length(filter(rows.item, (r) => (r.status != "x" AND r.status != "-"))) DESC