Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Items |
---|
Item 1 |
Item 2 |
Item 3 |
Item | QTY | Date |
---|---|---|
Item 1 | 5 | 1/3/13 |
Item 1 | 2 | 1/3/13 |
Item 2 | 7 | 1/1/13 |
Item 3 | 3 | 1/1/13 |
Item 3 | 4 | 1/2/13 |
Item 3 | 1 | 1/4/13 |
Work table
Item | Date |
---|---|
Item 1 | 1/3/13 |
Item 2 | 1/2/13 |
Item 3 | 1/2/13 |
Item 3 | 1/3/13 |
Result table
Item | Last Work Date | QTY at Date |
---|---|---|
Item 1 | 1/3/13 | 7 |
Item 2 | 1/2/13 | 7 |
Item 3 | 1/3/13 | 7 |
I am able to do all of this partially, but only if a single item is selected. Otherwise is shows 0 for all in 'QTY at Date.' I'm doing this by,
(SUM(IF(Transdate<=DATE(FIRSTSORTEDVALUE(workdate,-workdate))),transqty))
What I think is happening is that it is trying to compare the whole array of workdates, for all assets, to the transaction dates and when I select a single asset this solves the problem and it starts working. If you have any ideas of how to handle something like this better or what my problem might be I would appreciate it. Thanks. If you need any more information just let me know.
This showed me how to accomplish what I was wanting to do.
See attached example.
Thanks for the quick response. I think I might have simplified my question a bit too much. My problem now is that I need to look at an addition table to determine if the date in the Work Table is one of the dates that I'm interested in. I reworked your example a bit if you wouldn't mind checking it out. I think it will explain it better than I can.
Thanks again
This is probably a little more accurate for what I'm doing currenlty actually.
The right() is only in there because in the real version the template is something like XXX_XXX_A, etc.
This showed me how to accomplish what I was wanting to do.