Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
IMPORTANT: Upcoming LEF Database Maintenance, Oct. 3rd - SEE DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
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

5 Replies
Highlighted
Specialist II
Specialist II

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

Can you add the expected output.

Thanks

Highlighted
Specialist
Specialist

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

Creator
Creator

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.

Highlighted
Contributor III
Contributor III

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)

Highlighted
Contributor III
Contributor III

I'll try and let you know!