7 Replies Latest reply: Jul 18, 2012 12:48 PM by Stefan Wühl

# Interval between dates.

I have a table of stock and need to know the input frequency. I'm not having idea how to do this on the table.

The INPUT field is the starting point.

 DATA INICIAL ENTRADA SAIDA FINAL DIAS 01/06/2012 23,00 0,00 0,00 23,00 02/06/2012 23,00 0,00 0,00 23,00 03/06/2012 23,00 0,00 0,00 23,00 04/06/2012 23,00 0,00 0,00 23,00 05/06/2012 23,00 0,00 7,00 16,00 06/06/2012 16,00 0,00 0,00 16,00 07/06/2012 16,00 0,00 0,00 16,00 08/06/2012 16,00 50,00 0,00 66,00 8,00 09/06/2012 66,00 0,00 0,00 66,00 10/06/2012 66,00 0,00 0,00 66,00 11/06/2012 66,00 0,00 0,00 66,00 12/06/2012 66,00 0,00 1,00 65,00 13/06/2012 65,00 0,00 2,00 63,00 14/06/2012 63,00 0,00 0,00 63,00 15/06/2012 63,00 0,00 0,00 63,00 16/06/2012 63,00 0,00 0,00 63,00 17/06/2012 63,00 0,00 0,00 63,00 18/06/2012 63,00 0,00 0,00 63,00 19/06/2012 63,00 0,00 0,00 63,00 20/06/2012 63,00 0,00 0,00 63,00 21/06/2012 63,00 0,00 0,00 63,00 22/06/2012 63,00 0,00 0,00 63,00 23/06/2012 63,00 0,00 0,00 63,00 24/06/2012 63,00 0,00 0,00 63,00 25/06/2012 63,00 30,00 0,00 93,00 17,00 26/06/2012 93,00 0,00 0,00 93,00 27/06/2012 93,00 0,00 6,00 87,00 28/06/2012 87,00 0,00 0,00 87,00 29/06/2012 87,00 0,00 0,00 87,00
• ###### Re: Interval between dates.

I assume you should be able to calculate the date difference in the script, maybe like adding this to your script:

Let vStartDate = num(peek('DATA',0,'INPUT'));

LEFT JOIN LOAD DATA, rangesum(DATA,-rangemax(peek('DATA'),\$(vStartDate)-1)) as DELTA resident INPUT where ENTRADA >0;

Hope this helps,

Stefan

• ###### Re: Interval between dates.

I see that the scrip worked.

But how to do this is with some function in the graph?

I have other fields that are not in the above table that when filtered has to do the calculation "on line".

• ###### Re: Interval between dates.

You can try a chart expression with set analysis and advanced aggregation like

• ###### Re: Interval between dates.

Its function was successful.

But when I add another field as dimenssão she is not certain.

 DATA EMPRESA INICIAL ENTRADA SAIDA FINAL 363 30 9 384 22 04/06/2012 2 23 0 0 23 - 05/06/2012 2 23 0 7 16 - 13/06/2012 2 65 0 2 63 - 16/06/2012 2 63 0 0 63 - 17/06/2012 2 63 0 0 63 - 20/06/2012 2 63 0 0 63 - 25/06/2012 2 63 30 0 93 22

* INLINE [
DATA, INICIAL, ENTRADA, SAIDA, FINAL, EMPRESA
01/06/2012, "23,00", "0,00", "0,00", "23,00", 1
02/06/2012, "23,00", "0,00", "0,00", "23,00", 1
03/06/2012, "23,00", "0,00", "0,00", "23,00", 1
04/06/2012, "23,00", "0,00", "0,00", "23,00", 2
05/06/2012, "23,00", "0,00", "7,00", "16,00", 2
06/06/2012, "16,00", "0,00", "0,00", "16,00", 1
07/06/2012, "16,00", "0,00", "0,00", "16,00", 1
08/06/2012, "16,00", "50,00", "0,00", "66,00", 3
09/06/2012, "66,00", "0,00", "0,00", "66,00", 3
10/06/2012, "66,00", "0,00", "0,00", "66,00", 4
11/06/2012, "66,00", "0,00", "0,00", "66,00", 1
12/06/2012, "66,00", "0,00", "1,00", "65,00", 1
13/06/2012, "65,00", "0,00", "2,00", "63,00", 2
14/06/2012, "63,00", "0,00", "0,00", "63,00", 3
15/06/2012, "63,00", "0,00", "0,00", "63,00", 1
16/06/2012, "63,00", "0,00", "0,00", "63,00", 2
17/06/2012, "63,00", "0,00", "0,00", "63,00", 2
18/06/2012, "63,00", "0,00", "0,00", "63,00", 3
19/06/2012, "63,00", "0,00", "0,00", "63,00", 1
20/06/2012, "63,00", "0,00", "0,00", "63,00", 2
21/06/2012, "63,00", "0,00", "0,00", "63,00", 3
22/06/2012, "63,00", "0,00", "0,00", "63,00", 1
23/06/2012, "63,00", "0,00", "0,00", "63,00", 1
24/06/2012, "63,00", "0,00", "0,00", "63,00", 1
25/06/2012, "63,00", "30,00", "0,00", "93,00", 2
26/06/2012, "93,00", "0,00", "0,00", "93,00", 3
27/06/2012, "93,00", "0,00", "6,00", "87,00", 3
28/06/2012, "87,00", "0,00", "0,00", "87,00", 3
29/06/2012, "87,00", "0,00", "0,00", "87,00", 1
]

;

• ###### Re: Interval between dates.

I do get 25 returned from my expression with your new data, creating a table chart with dimensions DATA and EMPRESA, with EMPRESA = 2 selected. Not 22. Have you changed the vStartDate variable in any way?

If not, could you upload a sample that demonstrates your issue together with a description of your expected result?

• ###### Re: Interval between dates.

With the outcome variable was fixed.
Replaces the variable by the function ..
Without the new field "COMPANY" was working, now is bringing 22.
correct is 7.

She has to work according to the selection.

• ###### Re: Interval between dates.

22 seems to be ok to me if you want to calculate the time interval in days since the last update of ENTRADA (which is what I would expect if you ask for interval between dates).

It seems that you just want to count the number of dates instead, so maybe something like