Custom Aggregated field - Not supported as dimension

Hey guys, So I’ve looked into multiple QnAs for an answer but nothing really worked so far. Here is the problem statement- I’m trying to Identify Employee count who Scored >=90% .Here, the numerator has a test condition = “Acheived”, and denominator would be count of all tests. I attempted using the formula below -
ifelse(ifelse({test_result}=‘Achieved’,distinctCountOver(
{TEST_ID},[{STAFF_NAME},{TEST_RESULT}],PRE_FILTER),0)/
distinctCountOver({TEST_ID},[{STAFF_NAME}],PRE_FILTER)>=0.9,“Pass”,“Fail”)

It does the job for the most part BUT it won’t take into account multiple filters applied to the visual such as time frame(by month/quarter), geo location, etc. It takes the default percentage of the entire dataset attributed to an employee, which doesn’t help at all! Eg: An employee has 20 rows and half are from the previous quarter, and despite filtering for the current quarter it takes the whole data by default :confused:
FYI there are about 7 different conditions applied to all charts and they have their own issues
Any suggestions?