Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
su1
Contributor II
Contributor II

Calculating based on the first 20 of Call IDs per each agent

Hello everyone, 

This is what I have as my data.

Call ID
Timestamp
Agent ID
Col A
Col B
Col C

 

What I want to get is the sum of [Col A, Col B, and Col C] for the first 20 calls per each agent. I am currently experimenting with "Order by" and "Group by". It is not working out so far. 

Please let me know how I can achieve that. Any help would be really appreciated. Thank you, everyone!

 

Labels (3)
1 Solution

Accepted Solutions
Aditya_Chitale
Specialist
Specialist

Tried using bellow sample data:

test:
load * Inline
[
CallID,Timestamp,AgentID,ColA,ColB,ColC
1,10:00:00,ABC,10,20,30
2,11:00:00,ABC,10,20,30
3,12:00:00,ABC,10,20,30
4,13:00:00,ABC,10,20,30
5,14:00:00,ABC,10,20,30
6,15:00:00,ABC,10,20,30

7,10:00:00,XYZ,10,20,30
8,11:00:00,XYZ,10,20,30
9,12:00:00,XYZ,10,20,30
10,13:00:00,XYZ,10,20,30
11,14:00:00,XYZ,10,20,30
12,15:00:00,XYZ,10,20,30
13,16:00:00,XYZ,10,20,30
];

 

Ranking call id wise timestamps :

NoConcatenate

[Rank] :
load
    CallID,
    Timestamp,
    AgentID,
    ColA,
    ColB,
    ColC,
AutoNumber(Timestamp,AgentID) as Rank
Resident test order by Timestamp asc;

drop table test;

 

By using below expression, calculating top 3 ( in your case top 20) timestamp wise calls and sum of all 3  columns (col A,  Col B, Col C) :

= sum({<Rank={">=1<=3"}>}ColA)

Finally,  adding all 3 columns:

Column(1) + Column(2) + Column(3)

Aditya_Chitale_0-1679571235668.png

 

Regards,

Aditya

View solution in original post

4 Replies
Gabbar
Specialist
Specialist

Please elaborate the problem a little more with a little more data:
Does call ID  starts with 1 for every different agent ID, what does column timestamp signifies and also please share a SS of sample data if you can.

Aditya_Chitale
Specialist
Specialist

Tried using bellow sample data:

test:
load * Inline
[
CallID,Timestamp,AgentID,ColA,ColB,ColC
1,10:00:00,ABC,10,20,30
2,11:00:00,ABC,10,20,30
3,12:00:00,ABC,10,20,30
4,13:00:00,ABC,10,20,30
5,14:00:00,ABC,10,20,30
6,15:00:00,ABC,10,20,30

7,10:00:00,XYZ,10,20,30
8,11:00:00,XYZ,10,20,30
9,12:00:00,XYZ,10,20,30
10,13:00:00,XYZ,10,20,30
11,14:00:00,XYZ,10,20,30
12,15:00:00,XYZ,10,20,30
13,16:00:00,XYZ,10,20,30
];

 

Ranking call id wise timestamps :

NoConcatenate

[Rank] :
load
    CallID,
    Timestamp,
    AgentID,
    ColA,
    ColB,
    ColC,
AutoNumber(Timestamp,AgentID) as Rank
Resident test order by Timestamp asc;

drop table test;

 

By using below expression, calculating top 3 ( in your case top 20) timestamp wise calls and sum of all 3  columns (col A,  Col B, Col C) :

= sum({<Rank={">=1<=3"}>}ColA)

Finally,  adding all 3 columns:

Column(1) + Column(2) + Column(3)

Aditya_Chitale_0-1679571235668.png

 

Regards,

Aditya

su1
Contributor II
Contributor II
Author

ID doesn't start with 1 for every different agent ID and I was able to solve it using Aditya's solution. 

Thank you for your help.

su1
Contributor II
Contributor II
Author

Thank you so much, Aditya. 

I was using AutoNumber wrong. Instead of using it with a comma, I was using & between Timestamp and agentID. 🙄