locked
Running Total RRS feed

  • Question

  • I have the following data:
    CASE       DATE                              SHIFT  Scheduled  Inventory
    00831      2009-11-04 00:00:00.000 3         5244          39000
    00831      2009-11-05 00:00:00.000 1         5244          39000
    00831      2009-11-05 00:00:00.000 2         5244          39000
    00831      2009-11-05 00:00:00.000 3         5244          39000
    00831      2009-11-06 00:00:00.000 1         5244          39000
    00831      2009-11-06 00:00:00.000 2         5244          39000
    00831      2009-11-06 00:00:00.000 3         5244          39000
    00831      2009-11-07 00:00:00.000 1         5244          39000
    00831      2009-11-07 00:00:00.000 2         5244          39000

    What I need is to select the date and shift when the total inventory (39000) is less than the aggregated Scheduled number.  So I think what I need is another column that accumulates the total of Scheduled based on the last row's value.  The Total Inventory number is a static number and should not be aggregated whereas the Scheduled number is not.  So my first issue is how to aggregate that number (running total) and the second issue will be to select just that one date and shift when the Inventory value falls below the aggregated value.

    Thanks for any information.
    Monday, November 2, 2009 5:35 PM

All replies

  • Can you give an example of what your output would be for this example input? Do you need a running total of Scheduled for each date or over the whole dataset?
    every day is a school day
    Thursday, November 5, 2009 4:26 PM