Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good day,
Despite several postson this subject, I still not found the solution to my issue below:
I have a table with record of engine power, one line per minute and 1 year of records => huge amount of lines
I need to calculate for each record the average power of the 6O previous lines.
On a graph, I can use RangeAvg(Above([Power],0,60) but I need to calculate it on script level.
Any idea ???
Many thanks and kind regards
@demoustier can you share a sample data and the expected output ?
@demoustier one way you can try
Table:
LOAD signaldate,
Value
FROM
[C:\Users\talwars\Downloads\sample (2).xlsx]
(ooxml, embedded labels, table is Feuil1);
tmpTable:
LOAD RowNo() as RowNum,
*
Resident Table
Order By signaldate;
tmp2Table:
LOAD 0 as RowNum
AutoGenerate 0;
For i = 0 to 59
Concatenate (tmp2Table)
LOAD RowNum + $(i) as RowNum,
RowNum as OriginalRowNum,
Value
Resident tmpTable;
NEXT
Left Join (tmpTable)
LOAD RowNum,
Avg(Value) as Result
Resident tmp2Table
Group By RowNum;
DROP Tables Table, tmp2Table;
@demoustier can you share a sample data and the expected output ?
Hi,
attched sample set of data.
Column A and B are data, column C is the expected output.
On each row, I need in column C the average of the last 60 value in column B...
Thank you for your help !
Regards
@demoustier one way you can try
Table:
LOAD signaldate,
Value
FROM
[C:\Users\talwars\Downloads\sample (2).xlsx]
(ooxml, embedded labels, table is Feuil1);
tmpTable:
LOAD RowNo() as RowNum,
*
Resident Table
Order By signaldate;
tmp2Table:
LOAD 0 as RowNum
AutoGenerate 0;
For i = 0 to 59
Concatenate (tmp2Table)
LOAD RowNum + $(i) as RowNum,
RowNum as OriginalRowNum,
Value
Resident tmpTable;
NEXT
Left Join (tmpTable)
LOAD RowNum,
Avg(Value) as Result
Resident tmp2Table
Group By RowNum;
DROP Tables Table, tmp2Table;
Wow !!! Great !!!
it works perfectly with one set of data (one Entity) ! many thanks
Now I have to manage with several Entity
Many thanks !!!!!