Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

saiyed-hamid_ma
New Contributor

In a row: set min as zero; set difference to following values

Hi,

in a sorted (ascending) field I have values in seconds. In my load I want to set the minimum value of that field to zero. The following values should then be represented by the difference to the preceding value. Example:

I have:

Time
12
13
15
17
18

I want a new field Duration based on Time-Field:

Duration
0
1
2
2
1

How to calculate this during load?

Thanks,

Hamid

3 Replies
thiago_justen
Valued Contributor III

Re: In a row: set min as zero; set difference to following values

What about this:

Table_Temp:

Load

Time,

If(IsNull(Peek(Time)),0,Time-Peek(Time)) as Duration;

Load * Inline [

Time

12

13

15

17

18

];

Table:

NoConcatenate

Load * Resident Table_Temp Where Duration >=0;

Drop Table Table_Temp;

Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
thiago_justen
Valued Contributor III

Re: In a row: set min as zero; set difference to following values

Hey Saiyed,

Is your question solved? Please, let us know how it goes.

Cheers

Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
thiago_justen
Valued Contributor III

Re: In a row: set min as zero; set difference to following values

Hey Saiyed,

Any news about it? If this thread is solved, please let us know by marking the correct answer.

Cheers

Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
Community Browser