Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for
Did you mean:
Creator III

## Using Variable for Per Hour Calculations (Puzzling)

I created a Variable called "Worked Hours" which is a count of distinct days of the month that have stats, meaning our agents worked that day. We add 8 hours of time to each day worked to calculated their stats off of. So in short, each day the Worked Hours are increasing by 8 and I want to be able to  use this accumulative total to calculate their stats. The Variable is below and in this example there are 24 worked days so far for a total of 192 hours.

I have the "Agent Accts Worked" being calculated off of sum(if(DISPO>=2000,1,0)), which gives me 3,228 accounts. So I am trying to calculate 3,228 divided by the 192 (or whatever the accumulation is that day). I should be getting 16.8 Agent Accounts Worked Per Hour. Instead I am getting the below and I am not sure what I should change to make this work daily.

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

**When I just add the Variable into the Expression itself it works, but it only calculates off of the accumulative hours that THAT agent worked for the month, when I need the total amount of days X 8 that were worked that month...

1 Solution

Accepted Solutions

Hard to say exactly what's wrong without being able to see the data or the document your working on.

It looks like your variable Working Hours is evaluated for every agent instead of once for the document. Adding an = sign in front of the expression should solve that.

You can also try:

count({<DISPO={">=2000"}>} DISPO) / (count(total distinct [Call Start Time])*8)

The total keyword should make sure the count is over all agents.

talk is cheap, supply exceeds demand
2 Replies

Hard to say exactly what's wrong without being able to see the data or the document your working on.

It looks like your variable Working Hours is evaluated for every agent instead of once for the document. Adding an = sign in front of the expression should solve that.

You can also try:

count({<DISPO={">=2000"}>} DISPO) / (count(total distinct [Call Start Time])*8)

The total keyword should make sure the count is over all agents.

talk is cheap, supply exceeds demand
Creator III
Author

using the TOTAL did indeed work! thanks for taking the time to help me figure this out!

Community Browser