Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
in the following table where the Status_id = 4 i have to calculate the Result Cloumn by subtracting the update_date_time
highlighted in Orange- update_date_time in Green in HH:MM:SS
id_pk | Result Column(HH:MM:SS) | Status id | update_date_time |
---|---|---|---|
56327 | 1 | 2016-07-26 11:47:36 | |
56328 | 2 | 2016-07-26 11:47:59 | |
56330 | 3 | 2016-07-26 11:48:30 | |
56331 | 2016-07-26 11:49:29 - 2016-07-26 11:48:41=00:00:48 | 4 | 2016-07-26 11:48:41 |
56332 | 4 | 2016-07-26 11:49:29 | |
56334 | 3 | 2016-07-26 11:51:20 | |
I'd use Peek() in load script. Peek()
Can u show with example...or share qvf
Try the below() function. Something like:
if(Status_id=4, below(update_date_time) - update_date_time, '')
-Rob
You can use Peek(), but Peek() can only address rows already read in, not rows that are located in following records.
You can change the sort order of your table to overcome this:
INPUT:
LOAD id_pk,
[Result Column(HH:MM:SS)],
[Status id],
update_date_time
FROM
[https://community.qlik.com/thread/241212]
(html, codepage is 1252, embedded labels, table is @1);
Result:
LOAD *,
If(Peek('Status id') = 4 and [Status id] = 4,interval(Peek('update_date_time')- update_date_time )) as test
Resident INPUT
order by id_pk desc;
DROP TABLE INPUT;