Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

cancel
Showing results for 
Search instead for 
Did you mean: 
Keitaru
Creator
Creator

Peek() function to display time in new column of final event changes

This is a follow up question from my previous thread

https://community.qlik.com/t5/New-to-Qlik-Sense/Creating-start-and-end-time-from-singular-Column/m-p... Which has been solved thanks to @Vegar  also allowing me to understand how peek() works

 

So now I have a new problem which had tried to various way to resolved but was unable to.

So this is the current data after initial transformation:

Incident ID*+StartDateEndDateDuration (hh:mm:ss)Work Log TypeWork Log Event
INC00000044819901/01/2021 9:48:0201/01/2021 10:02:000:13:58Assignment ChangePerson 1
INC00000044819901/01/2021 9:48:0701/01/2021 9:53:330:05:26Status ChangeIn Progress
INC00000044819901/01/2021 9:53:3301/01/2021 10:02:040:08:31Status ChangeAssigned
INC00000044819901/01/2021 9:53:33--Assignment Group ChangeCMCC
INC00000044819901/01/2021 10:02:00--Assignment ChangePerson 2
INC00000044819901/01/2021 10:02:0401/01/2021 13:53:353:51:31Status ChangeIn Progress
INC00000044819901/01/2021 13:53:35--Status ChangeResolved

 

For the last few events I need them to have the "Resolved"  StartDate to be in the EndDate of  the other 2 Event changes in Bold. Since they should take in the resolved date time stamp as the Ticket has been resolved.

Here is my code below:

 

 

 

Load
[Incident ID*+],
[StartDate],
if(isnull([EndDate]),if(peek('Incident ID*+')=[Incident ID*+],If([Work Log Event]='Resolved',StartDate)),EndDate) as EndDate,
[Work Log Type],
[Work Log Event]
Source;

 

 

 

 

Not sure what i did wrong there.

Labels (1)
1 Solution

Accepted Solutions
Keitaru
Creator
Creator
Author

I manage to fix this myself. After some more trial and errors 

View solution in original post

4 Replies
JordyWegman
Partner - Master
Partner - Master

Hi Keitaru,

I don't really get why you need the if(peek('Incident ID*+')=[Incident ID*+] here. Why should it be the same?

But back to the question, do you know if the field is actually null()?

Try this:

Load
    [Incident ID*+],
    [StartDate],
    if( Trim([EndDate]) & '' = '' ,
        if(peek('Incident ID*+')=[Incident ID*+],
            If([Work Log Event]='Resolved',
                StartDate
            )
        )
        ,EndDate
    ) as EndDate,
[Work Log Type],
[Work Log Event]
Source;

 Jordy

Climber

Work smarter, not harder
Keitaru
Creator
Creator
Author

Hi,

Tried the code for some reason it isn't working for both anything with the [Work Log Type] = 'Assignment Change'  or  'Assignment Group Change' 

Current

Sample1.PNG

Supposed:

Sample2.PNG

Keitaru
Creator
Creator
Author

I manage to fix this myself. After some more trial and errors 

JordyWegman
Partner - Master
Partner - Master

Hi Keitaru,

Good to hear! Do you mind showing the fix maybe? It could help other people!

Jordy

Climber

Work smarter, not harder