Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
egsiegel
Frequent Visitor

Calculation on Measure Totals

I have a measure that calulates the number of minutes "worked" by an call center agent.  It takes the number of phone calls * the expected duration of a phone call and the number of emails handled * the number of minutes that an email should take to handle to calculate the time "worked".   There is a data row for each day, for each agent, for the period being dispayed.

 

I also have, in another table, the number of minutes that the agent was logged in for work.

 

so it looks something like this:

agentNameskillCountDate
FredCall2002/1/2021
SueCall952/1/2021
LizCall1302/1/2021
FredEmail1802/2/2021
SueEmail1352/2/2021
LizEmail1302/1/2021

My measure then takes this data an multplies Calls*5 and Emails*8 to get the workload (minutes) for each agent.

this is shown in a Matrix Visualization.

 

I now need to take the totals on that Matrix and find the percentage of time logged in (below in seconds) that the agent actually worked.   So I need to devide my measure total (multiple Days possibly) by the appropriate agents logged in time total (same date range).   

 

AgentNameLogintimeDate
Fred200002/1/2021
Sue250002/1/2021
Liz220002/1/2021
Fred220002/2/2021
Sue220002/2/2021
Liz220002/2/2021

            

I'm struggling with calculating the agent percetage based on the total work.

Thanks in advance for your help.

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @egsiegel 

According to your description and example, I can understand roughly your logic and the output you want to get, you can try this measure to replace the calculated column I created before to calculate the percent:

To test the function of this measure, I changed the sample data to make them within the same date, like this:

屏幕截图 2021-02-17 163722.png

 

agent percetage1 =

var _valueofCall=

CALCULATE(SUM(Merge1[Count]),FILTER(ALL(Merge1),[skill]="Call"&&[AgentName]=MAX('Merge1'[AgentName])))

var _valueofEmail=

CALCULATE(SUM(Merge1[Count]),FILTER(ALL(Merge1),[skill]="Email"&&[AgentName]=MAX('Merge1'[AgentName])))

var _valueoflogintime=

CALCULATE(SUM(Merge1[Table (2).Logintime]),FILTER(ALL(Merge1),[AgentName]=MAX('Merge1'[AgentName])))

return

DIVIDE(_valueofCall*5+_valueofEmail*8,_valueoflogintime)

 

Then you can create a table chart and place it like this:

v-robertq-msft_0-1613550912906.png

 

And I guess this can be what you want.

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
egsiegel
Frequent Visitor

thank you...that looks like what I am looking for....I will give it a shot

v-robertq-msft
Community Support
Community Support

Hi, @egsiegel 

According to your description and example, I can understand roughly your logic and the output you want to get, you can try this measure to replace the calculated column I created before to calculate the percent:

To test the function of this measure, I changed the sample data to make them within the same date, like this:

屏幕截图 2021-02-17 163722.png

 

agent percetage1 =

var _valueofCall=

CALCULATE(SUM(Merge1[Count]),FILTER(ALL(Merge1),[skill]="Call"&&[AgentName]=MAX('Merge1'[AgentName])))

var _valueofEmail=

CALCULATE(SUM(Merge1[Count]),FILTER(ALL(Merge1),[skill]="Email"&&[AgentName]=MAX('Merge1'[AgentName])))

var _valueoflogintime=

CALCULATE(SUM(Merge1[Table (2).Logintime]),FILTER(ALL(Merge1),[AgentName]=MAX('Merge1'[AgentName])))

return

DIVIDE(_valueofCall*5+_valueofEmail*8,_valueoflogintime)

 

Then you can create a table chart and place it like this:

v-robertq-msft_0-1613550912906.png

 

And I guess this can be what you want.

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-robertq-msft
Community Support
Community Support

Hi, @egsiegel 

According to your description and sample data, I can not understand your requirement clearly, but I guess the logic of your [agent percentage] can be [Count]* expected duration / [Logintime], am I right or I misunderstood?

If I’m right, you can try my steps:

  1. I go to the Power Query editor to merge the two tables to a new table ‘Append1’, here are my steps:

v-robertq-msft_0-1613116349680.png

v-robertq-msft_1-1613116349686.png

v-robertq-msft_2-1613116349689.png

 

  1. Then I created a calculated column:

 

agent percetage =

var _value=

SWITCH(

    [skill],

    "Call",[Count]*5,

    "Email",[Count]*8)

return

DIVIDE(_value,[Table (2).Logintime])

 

  1. I created a table chart and place like this:

v-robertq-msft_3-1613116349696.png

 

And I guess this can be what you want.

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

thank you for your resonse...

your understanding of what I am looking for is correct....unfortunately, you result has the same issue I am running into.  

In the Data, Fred is logged in for 20000 seconds on 2/1/2021.

Your result carries that 20000 into the merged table for both Email and Calls.

Your percentages show the percent of 20000 spent on Emails and the percent of 20000 spent on calls...it really calculates based on 40000 seconds of login time.

 

what I am trying to get to is ((Calls*5)+(Emails*8))/login_time)

this needs to be true for a single day as well as a date range (sum of calls)*5+(sum of emails * 8)/(sum of loginTime)  with logintime once for each day.

 

I hope this helps with the explanation of the issue.

and again...thank you in advance for your help

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.