Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Friends,
Below is my data set, I need to have only task which failed during last 5 days continuously.
For example- App name- Hospitality, is getting failed from 2nd NOV to 6th NOV 2020, so i only want this app with count 5 days in separate column.
[App Name] | [Task Name] | [Reload Status] | Last Reload Failure |
Hospitality | Reload task of Hospitality | FinishedFail | 2020-10-30 19:01:48 |
Hospitality | Reload task of Hospitality | FinishedFail | 2020-11-02 04:57:46 |
Hospitality | Reload task of Hospitality | FinishedFail | 2020-11-03 12:38:58 |
Hospitality | Reload task of Hospitality | FinishedFail | 2020-11-03 12:47:27 |
Hospitality | Reload task of Hospitality | FinishedFail | 2020-11-04 05:33:08 |
Hospitality | Reload task of Hospitality | FinishedFail | 2020-11-04 08:00:15 |
Hospitality | Reload task of Hospitality | FinishedFail | 2020-11-04 16:38:11 |
Hospitality | Reload task of Hospitality | FinishedFail | 2020-11-05 08:28:51 |
Hospitality | Reload task of Hospitality | FinishedFail | 2020-11-06 08:51:29 |
Hospitality | Reload task of Hospitality | FinishedFail | 2020-11-06 14:33:20 |
Hospitality | Reload task of Hospitality | FinishedFail | 2020-11-06 19:02:04 |
QLIK PLATFORM | Reload task of QLIK PLATFORM | FinishedFail | 2019-11-15 04:25:13 |
QLIK PLATFORM | Reload task of QLIK PLATFORM | FinishedFail | 2019-11-25 22:00:52 |
QLIK PLATFORM | Reload task of QLIK PLATFORM | FinishedFail | 2020-02-02 01:00:35 |
QLIK PLATFORM | Reload task of QLIK PLATFORM | FinishedFail | 2020-02-09 01:00:35 |
QLIK PLATFORM | Reload task of QLIK PLATFORM | FinishedFail | 2020-02-15 22:00:53 |
Desired Result | |||
[App Name] | [Task Name] | [Reload Status] | Count |
Hospitality | Reload task of Hospitality | FinishedFail | 5 |
Thanks
@rathorep One Solution:
Data:
LOAD [App Name],[Task Name],[Reload Status],Date(floor(Timestamp#([Last Reload Failure],'YYYY-MM-DD hh:mm:ss'))) as [Last Reload Failure] INLINE [
App Name, Task Name, Reload Status, Last Reload Failure
Hospitality, Reload task of Hospitality, FinishedFail, 2020-10-30 19:01:48
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-02 04:57:46
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-03 12:38:58
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-03 12:47:27
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-04 05:33:08
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-04 08:00:15
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-04 16:38:11
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-05 08:28:51
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-06 08:51:29
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-06 14:33:20
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-06 19:02:04
QLIK PLATFORM, Reload task of QLIK PLATFORM, FinishedFail, 2019-11-15 04:25:13
QLIK PLATFORM, Reload task of QLIK PLATFORM, FinishedFail, 2019-11-25 22:00:52
QLIK PLATFORM, Reload task of QLIK PLATFORM, FinishedFail, 2020-02-02 01:00:35
QLIK PLATFORM, Reload task of QLIK PLATFORM, FinishedFail, 2020-02-09 01:00:35
QLIK PLATFORM, Reload task of QLIK PLATFORM, FinishedFail, 2020-02-15 22:00:5
];
Tmp:
noconcatenate
load [App Name],[Task Name],[Reload Status],[Last Reload Failure] resident Data order by [App Name],[Task Name],[Reload Status],[Last Reload Failure] ;
drop table Data;
Tmp2:
noconcatenate
load *,if([App Name]=peek([App Name]) and [Task Name]=peek([Task Name]) and [Reload Status]=peek([Reload Status]), if([Last Reload Failure]=peek([Last Reload Failure])+1,peek(flag)+1, if([Last Reload Failure]=peek([Last Reload Failure]) ,peek(flag),0))) as flag resident Tmp;
drop table Tmp;
output:
noconcatenate
load * where Count=5;
load distinct [App Name],[Task Name],[Reload Status],count(distinct flag) as Count resident Tmp2 group by [App Name],[Task Name],[Reload Status];
drop table Tmp2;
output:
I want to do it in front end.
is this can be done in front end plz?
Hi @rathorep
Front end, try like below
LOAD *, Date(Floor(LastReloadFailure)) as LastReloadFailureDate INLINE [
AppName, TaskName, ReloadStatus, LastReloadFailure
Hospitality, Reload task of Hospitality, FinishedFail, 2020-10-30 19:01:48
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-02 04:57:46
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-03 12:38:58
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-03 12:47:27
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-04 05:33:08
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-04 08:00:15
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-04 16:38:11
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-05 08:28:51
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-06 08:51:29
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-06 14:33:20
Hospitality, Reload task of Hospitality, FinishedFail, 2020-11-06 19:02:04
QLIK PLATFORM, Reload task of QLIK PLATFORM, FinishedFail, 2019-11-15 04:25:13
QLIK PLATFORM, Reload task of QLIK PLATFORM, FinishedFail, 2019-11-25 22:00:52
QLIK PLATFORM, Reload task of QLIK PLATFORM, FinishedFail, 2020-02-02 01:00:35
QLIK PLATFORM, Reload task of QLIK PLATFORM, FinishedFail, 2020-02-09 01:00:35
QLIK PLATFORM, Reload task of QLIK PLATFORM, FinishedFail, 2020-02-15 22:00:53
];
If(Sum(Aggr(If(Above(ReloadStatus) = ReloadStatus and Date(Above(LastReloadFailureDate)+1)=Date(LastReloadFailureDate), 1, 0),AppName, TaskName, LastReloadFailureDate)) >= 4,
Sum(Aggr(If(Above(ReloadStatus) = ReloadStatus and Date(Above(LastReloadFailureDate)+1)=Date(LastReloadFailureDate), 1, 0),AppName, TaskName, LastReloadFailureDate))+1)
Screenshot:
P.S: Try in backend instead of front end for better performance.
I have used below expressions as I don't have direct column- "LastReloadFailureDate"
"LastReloadFailureDate": (timestamp(Max({<[Reload Failure]={1}>} LogTimeStamp)))
Expression I have used:
If(Sum(Aggr(If(Above([Reload Status]) = 'FinishedFail'
and Date(Above((timestamp(Max({<[Reload Failure]={1}>} LogTimeStamp))))+1)=Date((timestamp(Max({<[Reload Failure]={1}>} LogTimeStamp)))), 1, 0)
,[App Name], [Task Name], (timestamp(Max({<[Reload Failure]={1}>} LogTimeStamp))))) >= 4,
Sum(Aggr(If(Above([Reload Status]) = 'FinishedFail' and Date(Above((timestamp(Max({<[Reload Failure]={1}>} LogTimeStamp))))+1)=Date((timestamp(Max({<[Reload Failure]={1}>} LogTimeStamp)))),
1, 0),[App Name], [Task Name],
(timestamp(Max({<[Reload Failure]={1}>} LogTimeStamp)))))+1)
but I am getting "-" only in column. Request you to please help where i am writing wrong code.
Thanks!