Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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_

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
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
Thiago_Justen_

Hey Saiyed,

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

Cheers

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
Thiago_Justen_

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
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago