Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 su1
		
			su1
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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!
 Aditya_Chitale
		
			Aditya_Chitale
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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)
Regards,
Aditya
 Gabbar
		
			Gabbar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
		
			Aditya_Chitale
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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)
Regards,
Aditya
 su1
		
			su1
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
		
			su1
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thank you so much, Aditya.
I was using AutoNumber wrong. Instead of using it with a comma, I was using & between Timestamp and agentID. 🙄
