Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Special aggregation in Pivot Table

Hello there,

I've created a pivot table for an inventory management document. The basic idea is that I have an on-hand section and then demand for the next few days. Each day of demand has a subtotal for that day's orders. The quantities are loaded from a SQL stored procedure initially, but the requirement is that, in QlikView, users can manually change quantities and then have those changes reflected in the subtotals. I set the input field and used InputSum(Quantity) as the expression on the pivot table. So all that is working great.

I now need to show another row beneath each demand day's subtotal (probably call it "Available"), which calculates how much is left over after each day of demand. If you take the "1065" column as an example (in the red rectangle; see picture), I would need to calculate 350 (the on-hand quantity) - 425 (the demand quantity for May 9) = -75. So "-75" would be the "Available" quantity on May 9.

Then, underneath the May 10 subtotal, I would need to calculate 350 - 425 - 210 = -285.

So always the total on-hand minus the total demand up to and including the particular day, to show me how much I have left to work with.

I've tried all kinds of aggregate functions and attempts at using expressions that only sum certain date ranges, etc. but I'm not getting anywhere. If there were no input fields, this would be easy, and I would simply do the aggregation in SQL and be done with it, but since the requirement is that users can input numbers and then see the totals change, I'm at a loss.

Any help would be appreciated.

qlikview pic.JPG

0 Replies