Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Hope all is well,
Please help me on one scenario where I need a code which provide me incremental Flag numbers based on id , Date and Rank.
For example
if a id have four zero ranking then it should be show the result like for first Zero the flag will be Issue1 for second zero rank Flag will be Issue2.. and so on.
I am attaching a sample data with expected result column.
Hi Vahanan
One more question if i need to find Last Agent name based on id, Rank and Datetime on same dataset. How can i do that. Do i need to use the same logic and sort that data in desc order. Please suggest.
id | DateTime | Rank | LastCall | Expected Result | Last Agent | AGENT NAME |
Abcdef | 2021-01-04 13:54:32 | 0 | 0 | Issue 1 | Bailee Prom | Aleida Sidney |
Abcdef | 2021-01-07 14:11:25 | 1 | 2021-01-04 13:54:32 | Issue 1 | Bailee Prom | Michele Smart |
Abcdef | 2021-01-11 16:18:23 | 2 | 2021-01-07 14:11:25 | Issue 1 | Bailee Prom | Amy Nall |
Abcdef | 2021-01-21 10:40:11 | 3 | 2021-01-11 16:18:23 | Issue 1 | Bailee Prom | Jane Lamfers |
Abcdef | 2021-01-22 15:46:38 | 4 | 2021-01-21 10:40:11 | Issue 1 | Bailee Prom | Alan **bleep**an |
Abcdef | 2021-01-25 14:17:20 | 5 | 2021-01-22 15:46:38 | Issue 1 | Bailee Prom | Michael Gaydos |
Abcdef | 2021-01-26 12:26:09 | 6 | 2021-01-25 14:17:20 | Issue 1 | Bailee Prom | Michael Gaydos |
Abcdef | 2021-02-01 13:57:12 | 7 | 2021-01-26 12:26:09 | Issue 1 | Bailee Prom | Alan **bleep**an |
Abcdef | 2021-02-05 13:06:56 | 8 | 2021-02-01 13:57:12 | Issue 1 | Bailee Prom | Cleanna Castro Fessler |
Abcdef | 2021-02-09 14:03:09 | 9 | 2021-02-05 13:06:56 | Issue 1 | Bailee Prom | David Williams |
Abcdef | 2021-02-22 15:49:25 | 10 | 2021-02-09 14:03:09 | Issue 1 | Bailee Prom | Liz Etouke |
Abcdef | 2021-03-04 09:51:54 | 11 | 2021-02-22 15:49:25 | Issue 1 | Bailee Prom | Emanuel Uzoka |
Abcdef | 2021-03-09 11:06:49 | 12 | 2021-03-04 09:51:54 | Issue 1 | Bailee Prom | Bailee Prom |
Abcdef | 2021-03-25 10:00:03 | 0 | 2021-03-09 11:06:49 | Issue 2 | Jolene Barkema | Kevin Burton |
Abcdef | 2021-03-29 08:16:57 | 1 | 2021-03-25 10:00:03 | Issue 2 | Jolene Barkema | Cecilia Conrad |
Abcdef | 2021-03-29 13:45:41 | 2 | 2021-03-29 08:16:57 | Issue 2 | Jolene Barkema | Michael Gaydos |
Abcdef | 2021-03-31 14:22:09 | 3 | 2021-03-29 13:45:41 | Issue 2 | Jolene Barkema | Yaritza Quezada |
Abcdef | 2021-04-02 13:21:04 | 4 | 2021-03-31 14:22:09 | Issue 2 | Jolene Barkema | Yaritza Quezada |
Abcdef | 2021-04-06 09:52:51 | 5 | 2021-04-02 13:21:04 | Issue 2 | Jolene Barkema | Jolene Barkema |
efghui | 2021-04-26 15:32:01 | 0 | 2021-04-06 09:52:51 | Issue 1 | Nickie Burress | Emanuel Uzoka |
efghui | 2021-04-28 09:07:59 | 1 | 2021-04-26 15:32:01 | Issue 1 | Nickie Burress | Yaritza Quezada |
efghui | 2021-04-30 09:19:54 | 2 | 2021-04-28 09:07:59 | Issue 1 | Nickie Burress | Yaritza Quezada |
efghui | 2021-05-05 14:34:03 | 3 | 2021-04-30 09:19:54 | Issue 1 | Nickie Burress | Nickie Burress |
efghui | 2021-05-25 13:38:15 | 0 | 2021-05-05 14:34:03 | Issue 2 | Yaritza Quezada | Amy Nall |
efghui | 2021-06-02 10:50:09 | 1 | 2021-05-25 13:38:15 | Issue 2 | Yaritza Quezada | Tara Carson |
efghui | 2021-06-02 10:53:10 | 2 | 2021-06-02 10:50:09 | Issue 2 | Yaritza Quezada | Yaritza Quezada |
Thank you Kushal,
just one more question can i use same logical to get Last Agent name based on Issue flag.. Please see the expected result in image i am also attaching sample data for that.
id | DateTime | Rank | LastCall | Expected Result | Last Agent | AGENT NAME |
Abcdef | 2021-01-04 13:54:32 | 0 | 0 | Issue 1 | Bailee Prom | Aleida Sidney |
Abcdef | 2021-01-07 14:11:25 | 1 | 2021-01-04 13:54:32 | Issue 1 | Bailee Prom | Michele Smart |
Abcdef | 2021-01-11 16:18:23 | 2 | 2021-01-07 14:11:25 | Issue 1 | Bailee Prom | Amy Nall |
Abcdef | 2021-01-21 10:40:11 | 3 | 2021-01-11 16:18:23 | Issue 1 | Bailee Prom | Jane Lamfers |
Abcdef | 2021-01-22 15:46:38 | 4 | 2021-01-21 10:40:11 | Issue 1 | Bailee Prom | Alan **bleep**an |
Abcdef | 2021-01-25 14:17:20 | 5 | 2021-01-22 15:46:38 | Issue 1 | Bailee Prom | Michael Gaydos |
Abcdef | 2021-01-26 12:26:09 | 6 | 2021-01-25 14:17:20 | Issue 1 | Bailee Prom | Michael Gaydos |
Abcdef | 2021-02-01 13:57:12 | 7 | 2021-01-26 12:26:09 | Issue 1 | Bailee Prom | Alan **bleep**an |
Abcdef | 2021-02-05 13:06:56 | 8 | 2021-02-01 13:57:12 | Issue 1 | Bailee Prom | Cleanna Castro Fessler |
Abcdef | 2021-02-09 14:03:09 | 9 | 2021-02-05 13:06:56 | Issue 1 | Bailee Prom | David Williams |
Abcdef | 2021-02-22 15:49:25 | 10 | 2021-02-09 14:03:09 | Issue 1 | Bailee Prom | Liz Etouke |
Abcdef | 2021-03-04 09:51:54 | 11 | 2021-02-22 15:49:25 | Issue 1 | Bailee Prom | Emanuel Uzoka |
Abcdef | 2021-03-09 11:06:49 | 12 | 2021-03-04 09:51:54 | Issue 1 | Bailee Prom | Bailee Prom |
Abcdef | 2021-03-25 10:00:03 | 0 | 2021-03-09 11:06:49 | Issue 2 | Jolene Barkema | Kevin Burton |
Abcdef | 2021-03-29 08:16:57 | 1 | 2021-03-25 10:00:03 | Issue 2 | Jolene Barkema | Cecilia Conrad |
Abcdef | 2021-03-29 13:45:41 | 2 | 2021-03-29 08:16:57 | Issue 2 | Jolene Barkema | Michael Gaydos |
Abcdef | 2021-03-31 14:22:09 | 3 | 2021-03-29 13:45:41 | Issue 2 | Jolene Barkema | Yaritza Quezada |
Abcdef | 2021-04-02 13:21:04 | 4 | 2021-03-31 14:22:09 | Issue 2 | Jolene Barkema | Yaritza Quezada |
Abcdef | 2021-04-06 09:52:51 | 5 | 2021-04-02 13:21:04 | Issue 2 | Jolene Barkema | Jolene Barkema |
efghui | 2021-04-26 15:32:01 | 0 | 2021-04-06 09:52:51 | Issue 1 | Nickie Burress | Emanuel Uzoka |
efghui | 2021-04-28 09:07:59 | 1 | 2021-04-26 15:32:01 | Issue 1 | Nickie Burress | Yaritza Quezada |
efghui | 2021-04-30 09:19:54 | 2 | 2021-04-28 09:07:59 | Issue 1 | Nickie Burress | Yaritza Quezada |
efghui | 2021-05-05 14:34:03 | 3 | 2021-04-30 09:19:54 | Issue 1 | Nickie Burress | Nickie Burress |
efghui | 2021-05-25 13:38:15 | 0 | 2021-05-05 14:34:03 | Issue 2 | Yaritza Quezada | Amy Nall |
efghui | 2021-06-02 10:50:09 | 1 | 2021-05-25 13:38:15 | Issue 2 | Yaritza Quezada | Tara Carson |
efghui | 2021-06-02 10:53:10 | 2 | 2021-06-02 10:50:09 | Issue 2 | Yaritza Quezada | Yaritza Quezada |
@manojin123 try below
Data:
LOAD id,
DateTime,
Rank,
LastCall,
Agent_Name
FROM
[C:\sample_Data.xlsx]
(ooxml, embedded labels, table is Sheet1);
Left Join(Data)
LOAD id,
max(Rank) as Max_Rank
Resident Data
Group by id;
Left Join(Data)
LOAD id,
Agent_Name
Resident Data
where Rank=Max_Rank;
Final:
LOAD *,
if(id<>Previous(id) or RowNo()=1,'Issue '&1,
if(id=Previous(id) and Rank=0, 'Issue '&rangesum(keepchar(Peek('issue'),'0123456789'),1),Peek('issue'))) as issue
Resident Data
Order by id,DateTime,Rank;
DROP Table Data;
DROP Field Max_Rank;
Hi Kushal,
I need Last Agent Name who took the call for Issue 1 and same way for Issue2.
Thank
Manoj
@manojin123 Try below
Data: LOAD id, DateTime, Rank, LastCall, Agent_Name FROM [C:\sample_Data.xlsx] (ooxml, embedded labels, table is Sheet1); Left Join(Data) LOAD id,
Rank, max(Rank) as Max_Rank Resident Data Group by id,Rank; Left Join(Data) LOAD id, Agent_Name Resident Data where Rank=Max_Rank; Final: LOAD *, if(id<>Previous(id) or RowNo()=1,'Issue '&1, if(id=Previous(id) and Rank=0, 'Issue '&rangesum(keepchar(Peek('issue'),'0123456789'),1),Peek('issue'))) as issue Resident Data Order by id,DateTime,Rank; DROP Table Data; DROP Field Max_Rank;
@manojin123 try below
Data:
LOAD id,
DateTime,
Rank,
LastCall,
Agent_Name
FROM
[C:\sample_Data.xlsx]
(ooxml, embedded labels, table is Sheet1);
Final:
LOAD *,
if(id<>Previous(id) or RowNo()=1,'Issue '&1,
if(id=Previous(id) and Rank=0, 'Issue '&rangesum(keepchar(Peek('issue'),'0123456789'),1),Peek('issue'))) as issue
Resident Data
Order by id,DateTime,Rank;
DROP Table Data;
Left Join(Data)
LOAD id,
issue,
max(Rank) as Max_Rank
Resident Data
Group by id,issue;
Left Join(Data)
LOAD id,
issue,
Agent_Name as Last_Agent
Resident Data
where Rank=Max_Rank;
DROP Field Max_Rank;