Do a "Sumif" using CASE that's independent of other CASEs
How do I create a beast mode calculation to "sumif" without letting other CASE affecting?
Apologies for the vague description, I'm unsure on how to word this. This is my example dataset
I want to create a table card that looks like this, where MyCol is a calculated column populated by the sum of Cost when Metrics = Sales
|Metrics||sum of Values||MyCol|
(CASE when `Metrics`='Sales' then SUM(case when `Metrics`='Cost' then `Values` else 0 end) else 0 end)
doesn't work because by the time the sum calculation is done, all Cost rows have already been eliminated by the first CASE.
Could anyone help with this?