Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
neelamsaroha157
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

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

groveliam
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.

Anonymous
Not applicable
Author

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)

Anonymous
Not applicable
Author

I'll try and let you know!