I have a window function that takes the total count for a given error code and divides that by the total number of samples run. If a sample is run and does not generate an error, i.e. it completes successfully, then there is no error code.
In order to calculate the Error rate (we use Errors per Million Samples), I need to count the errors, divide by the total samples run and then multiply by 100. I can do this easily enough with this beastmode:
(sum(case when `Status`='Exception' then `TotalSamples` else 0 end)
/ sum(sum(`TotalSamples`)) over ()
) * 1000000
However, if I put this calculation on a card and then interact with another card on the dashboard using interactive filters to select a certain error code, then that interactive filter will over-rule the window function so that the calculation no longer sees those samples that did not have a specific error code.
Is there a way to write a window function or fixed function so that it will calculate correctly even when an interactive filter is used?