Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hy everyone!
I'm stuck with this situation/condition
Suppose I have this simple table ordered by date, with day and q as a quantity of something. I need to build an accumulator that accumulates Q only within the same day. So day 1-1-2018 ends with 4 and day 2-1-2018 ends with 6
Day | Q | Conditional Acumulator |
---|---|---|
2-1-2018 | 1 | 1 |
2-1-2018 | 3 | 4 |
2-1-2018 | 0 | 4 |
2-1-2018 | 2 | 6 |
1-1-2018 | 3 | 3 |
1-1-2018 | 1 | 4 |
I build this sentence but is missing the last row of each day...
If(Date(day-1) = Previous(day), Acum+q) as acum,
Can anyone have a clue of how to get this done the way I need?
Thanks in advance!
Christian
Are you looking for sum of quantity by day? Not sure what you mean by accumulator.
Can you add the expected output.
Thanks
Hi,
DATA:
LOAD*, If(Day=Previous(Day),PEEK(Acum)+Q,Q) AS Acum;
LOAD Day,
Q,
[Conditional Acumulator]
FROM
[..\..\descargas\ENERO.xlsx]
(ooxml, embedded labels, table is Sheet2);
I would say try some set analysis that works with Sum(q) like SUM({<Day = {Day}>}Q)
That may not be correct but doesn't hurt to try and is fast.
Thanks for your reply!
My expected output is, when I sum the acum by date, it returns
1-1-2018 = 4 (because calculation must be 3+1)
2-1-2018 = 6 (because calculation must be 2+0+3+1)
I'll try and let you know!