Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
ch_thies
New Contributor III

Help with condition

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

DayQConditional Acumulator
2-1-201811
2-1-201834
2-1-201804
2-1-201826
1-1-201833
1-1-201814

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

Tags (3)
5 Replies
neelamsaroha157
Valued Contributor II

Re: Help with condition

Are you looking for sum of quantity by day? Not sure what you mean by accumulator.

Can you add the expected output.

Thanks

el_aprendiz111
Valued Contributor

Re: Help with condition

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);

groveliam
Contributor

Re: Help with condition

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.

ch_thies
New Contributor III

Re: Help with condition

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)

ch_thies
New Contributor III

Re: Help with condition

I'll try and let you know!