Dataview - Inventory Summary - Missing values

What I’m trying to do

I have an home inventory folder in which each note contains the same key:values set, among which Room, Category and Cost.

Things I have tried

I know how to produce a table showing the count and total cost of items in each room or category:

TABLE length(rows) AS "Count", sum(rows.Cost) AS "TotalCost"
FROM "Inventory"
GROUP BY Category

However, for some items, there is no value in front of the Cost key because it is unknown or not assessed yet, in which case DV seems to exclude the whole Category or Room from the table.

Is there a way to tell DV that any missing Cost value should be considered zero $ instead?


Try something like sum(map(rows, (r) => default(r.Cost, 0))) AS "TotalCost"

FWIW, I recreated and it worked for me. Perhaps a refresh is in order ?

Perfect, many thanks! I used the same code in a second table showing the grand totals:

true AS "Total", 
length(rows) AS "Count", 
sum(map(rows, (r) => default(r.Cost, 0))) AS >"TotalCost"
FROM "Inventory"

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