Search code examples
sqlsplunk-query

i have 3 columns , total count , pass count , and fail count , how do i write formula in SQL or SPL if fail count is > 8% its development error


i have 3 columns , total count , pass count , and fail count , how do i write formula in SQL or SPL if fail count is > 8% it is development error?

sample input -
pass count - 3900 , 5500 , 2500
total count - 3920, 5700, 3000
fail count - 20 , 200 , 500
formula for if fail count is more then 8% its sends dev error.


Solution

  • This is simple arithmetic to calculate percentage then apply filter criteria to calculated field, like:

    SELECT Counts.*, [FailCount]/[TotalCount]*100 AS PctFail
    FROM Counts
    WHERE ((([FailCount]/[TotalCount]*100)>8));
    

    Build a report to show that dataset.