Assuming that you intend to use a Dataset
with named rows (and being aware that this means that each row must have a unique name), one way is:
(*define the dataset*)
data = Dataset[<|"Sue" -> <|"Day" -> "Tue", "Rate" -> 13|>,
"Paul" -> <|"Day" -> "Wed", "Rate" -> 10|>,
"Leslie" -> <|"Day" -> "Thurs", "Rate" -> 15|>,
"Sam" -> <|"Day" -> "Fri", "Rate" -> 9|>|>]
(*illustrative example: just applying the operation and return only the Rate column*)
data[Select[10 <= #["Rate"] <= 14 &], "Rate"]
(*Answer to the question: apply the operation and return only the total*)
data[Select[10 <= #["Rate"] <= 14 &], "Rate"][Total]
Alternatively, you can also define your search as a Query
, and try something like:
selectQ = Query[Select[10 <= #Rate <= 14 &], "Rate"];
Total@selectQ[data]
(note that either #["Rate"]
or #Rate
can be used to denote the named column.)
--Edit--
As J. M.'s ennui pointed out in the comments, there is also the ability to apply Total
using a right-composition (/*
). This allows you to incorporate the Total
operation into the Query
, like follows:
totalQ = Query[Select[10 <= #Rate <= 14 &] /* Total, "Rate"];
totalQ[data]
(You are also free to use the Between
function in any of these, as demonstrated in J.M.'s comment, if that seems more natural.)