Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have the following table:
Group | Timestamp | Anzahl_Tagessumme | ?? growth |
---|---|---|---|
A | 12:00 | 5 | 5 |
A | 13:00 | 10 | 5 |
A | 14:00 | 15 | 5 |
A | 15:00 | 25 | 10 |
B | |||
B |
I only have the first two columns => I don't have the third one (?? growth).
Now I want to show not the sum in a diagramm - but the growth.
How can this be calculated in the backend?
But it doesn't work. Can u help?
Thank you!
Try this script:
Table:
LOAD * INLINE [
Group, Timestamp, Anzahl_Tagessumme
A, 12:00, 5
A, 13:00, 10
A, 14:00, 15
A, 15:00, 25
];
FinalTable:
LOAD *,
If(Group = Previous(Group), RangeSum(Anzahl_Tagessumme, -Previous(Anzahl_Tagessumme)), Anzahl_Tagessumme) as Growth
Resident Table
Order By Group, Timestamp;
DROP Table Table;
Try using Peek/Previous functions, Peek() vs Previous() – When to Use Each
and for Grouping use Aggr() function
Try this script:
Table:
LOAD * INLINE [
Group, Timestamp, Anzahl_Tagessumme
A, 12:00, 5
A, 13:00, 10
A, 14:00, 15
A, 15:00, 25
];
FinalTable:
LOAD *,
If(Group = Previous(Group), RangeSum(Anzahl_Tagessumme, -Previous(Anzahl_Tagessumme)), Anzahl_Tagessumme) as Growth
Resident Table
Order By Group, Timestamp;
DROP Table Table;
try this script
aa:
load *,
if(Group=Previous(Group),Anzahl_Tagessumme-Previous(peek('growth')),Anzahl_Tagessumme) as growth;
load * inline [Group, Timestamp, Anzahl_Tagessumme
A, 12:00, 5
A, 13:00, 10
A, 14:00, 15
A, 15:00, 25
B
B];