I have a table A with SKU ID's, required dates and demand and another table B with current inventory positions. For each SKU ID, the inventory from table B will be the initial value and for each required date, I want to create two new columns, beginning inventory and ending inventory, which will get calculated based on the corresponding demand. I've attached an image with the output
I found a similar thread which used CTE recursion but it only applied to one ID. Given that I have multiple ID's, i would like the code to be dynamic and realize when all records for the previous ID have been exhausted so that for the next ID, it can pull a new beginning inventory from table B
Thanks
Desired Output:
Related
To set this up....I have roughly 12,000 rows of data that captures sales detail activity. I have an Excel function in a column to the right of the data that identifies the invoice number based on unique qualifiers (if the transcation meets the qualifier it lists the invoice number and, if not, assigns ""). Of the 12,000 rows of data maybe 50 will qualify. I then need to use the invoice numbers that qualify to pull sales and COGS data for all those invoices that match the qualifying invoice numbers (another explanation is necessary at this point....an invoice that qualifies will be listed twice....once that contains the information that identifies whetehr it qualifies but that row will have no sales data and a second time with thye dsales data...I do not know why it does it this way. So, in other words, the row of data with the sales information I need to capture does not contain the data that allows me to recognize that an invoice qualifies). Each mopnth adds the current month's sales data to the population...so, 12,000 rows this month and it will be 16,000 next month and so on.
I was hoping to create a table that pulls only the qualifuying invoice numbers from the sales data (it would basically create a table of 50 (in my example) while ignoring the 11,950 rows where the cell equals ""). I can do a simple pivot table but next month I need it to recognize the new population of data and update based on the additional rows of new monthly data as well as the rows of data from prior months.
Any soultions/ideas are much appreciated!
I have a master list of SKUs in one table set as a column with a different SKU listed in each row.
I have another table with a daily snapshot of items which I have in stock between 7/1/17 and 7/31/17 in each row. The table shows the item SKU in one column, the warehouse where there is quantity in another column, and the quantity available within that warehouse in another column. There can be multiple occurrences of a SKU on one date if there are quantity in multiple warehouses. The table only lists SKUs on occurrences where there is quantity within a warehouse. If a SKU has no quantity within any of the warehouses on a date, it will not be listed in the table corresponding with that date.
In my table with the master list of SKUs I want to create a column that will show the the number of days within a range of dates (7/1/17 to 7/8/17) in which there were no quantity of the SKU being referenced available in any warehouse.
To show a more precise idea of what it is I am trying to do, I have posted a youtube video here: http://youtu.be/6CWLN6wzaWQ?hd=1
Have a look at the following URLs - I feel partially similar cases are discussed and resolved over there.
It will surely give you some lead to further work on.
How to return multiple values between two dates in excel?
https://answers.microsoft.com/en-us/office/forum/office_2007-excel/finding-missing-dates-in-column/8c49800a-6997-4585-b1f4-abdeaa64e718
I'm a complete Access noob and I'm creating a database to keep track of orders shipped for work. I've got two tables in the database, one keeping track of the units shipped and the other keeping track of each purchase order and how many more items until that order can be closed. What I want to do is, basically, like a COUNTIF function from Excel on the entries from Table A and transfer to Table B. An example:
Table A has:
PO123
PO123
PO234
PO123
What I want Table 2 to do is count the number of instances of each PO and display the count in a field, like so:
Table B:
Row 1 Field 1: PO123
Row 1 Field 2: 3
Row 2 Field 1: PO234
Row 2 Field 2: 1
Anyone have any ideas? Any help is greatly appreciated.
You didn't say what the name of the field was, so I'm going to assume it's POTYPE. You need to create a query in Access, and go to the SQL view. Then you can do a query like
Select POTYPE, Count(POTYPE) From TableA Group By POTYPE
I'm storing a log on the server with multiple lists where I store some data such as dates and information associated to these dates. The first field of the first list corresponds to the first field of the rest, the second field of the first list to the second field, and so on.
Using the FLATTEN function I managed to show this information, but it shows a combination of the whole data on the lists. Having 4 lists 3 fields each, generates 12 different rows.
Is there any way to show only three results, by order on the lists?
I don't love this solution, but it's the first idea that comes to mind that solves your problem:
SELECT dates, lead, userID FROM
(SELECT NTH(1, dates) WITHIN RECORD dates, NTH(1, lead) WITHIN RECORD lead, userID
FROM [egolike.com:egolike-production:egotest.egoViews]),
(SELECT NTH(2, dates) WITHIN RECORD dates, NTH(2, lead) WITHIN RECORD lead, userID
FROM [egolike.com:egolike-production:egotest.egoViews]),
(SELECT NTH(3, dates) WITHIN RECORD dates, NTH(3, lead) WITHIN RECORD lead, userID
FROM [egolike.com:egolike-production:egotest.egoViews])
WHERE dates IS NOT NULL
Basically we are mapping the Nth value of a column within a record to the Nth value of the other column. A drawback is the need of explicitly calling each Nth place by number. Hopefully you can re-import the data with a different structure! (One repeated column, containing the aligned records)
I have Statistic table with these fields Id UserId DateStamp Data
Also there is User table in database which has CreditsLeft(int) field. I need to create function(let's name it FindNewRecordsAndUpdate) which will read Statistic table every 10 minutes from my application and decrease CreditLeft field by number of new Statistic records found for specified user.
My main concern is when I execute FindNewRecordsAndUpdate function next time how to find new records in Statistic field and skip already counted ones? I could add Counted(bool) field in Statistic and set True for already "used" records but maybe there is better solution withotu adding new field?
At least 3 other options:
Use a trigger. So when rows are inserted into the Statistic table, the balance is User is automatically updated
Just do an aggregate on demand over the Statistic table to get the SUM(Data)
Use an indexed view to "pre calculate" the SUM in point 2
Personally, I'd go for point 2 (and point 3 depending on query frequency) to avoid denormalised data in the User table.