I am looking to calculate the z-scores for the number of calls answered by a given call center agent. Each Agent can have either a standard or non-standard role.
I have an Agent_Data table containing each of the agent names and their roles. I also have a Call_Data table which contains a listing for each incoming call. Pertinent columns include the date of the call and the agent who answered. I also
I have two slicers in my report. One is for the agent role. The other is for the date range. I have mapped the date slicer to the date column in a calendar table.
In order to calculate the mean, I added a column to my Agent_Data table to count the calls answered by that agent:
Calls_Taken = COUNTA(Call_Data[StartDate])+0
The 0 in the above formula is so that the mean will take into consideration Agents who did not take any calls. I then have a measure to calculate the mean, another to calculate the Standard Deviation:
Mean_Calls_Taken = calculate(average(Agent_Data[Calls_Taken]),allselected(Agent_Data))
StDev_Calls_Taken = calculate(STDEV.P(Agent_Data[Calls_Taken]),allselected(Agent_Data))
These allow me to create a third measure to calculate an individual Agent's Z-score based on the mean and stdev of the group:
Z-Score_Calls_Taken = (sum(Agent_Data[Calls_Taken])-[Mean_Calls_Taken])/[StDev_Calls_Taken]
All of this works if I filter based on Role. But I am unable to find a way to enact a date-based filter. If I use a time slicer, the Calls_Taken column does not change. If I move the Calls_Taken column under the Call_Data table, the numbers DO change as desired. The problem is that all of the Agents with 0 calls appear blank instead of Zero. This changes the mean.
See the screenshots below. Notice how when I change the time frame, the first two columns change (As desired). The Third column removes the zero values and the Non-zero values remain constant (not desired). The mean and stdev change, but only because the previous zero values have become blank instead.
Any help in this would be appreciated. Thank you.