Need some insight for inventory management application
I will preface this by saying that I have no idea what I am doing.
EDIT: Thanks to u/Infamous_Let_4581's comment below I was able to realize how simple my mistake was. I was thinking of dates like they are in excel; decimal time codes, but that is not how PowerApps looks at them. So, when I was trying to create a rollup column in my Products table, to reference my Transactions table, I was setting the Data Type to Decimal and wondering why it wasn't showing up, thinking that I was just unable to reference another table. After *successfully* creating two different rollup columns, one for each max and min transaction dates, I was able to create a third column that was a formula data type. BUT this only worked because of the same comment below, where it was suggested to use the datediff() function, because at first, I just tried to subtract them from each other, but that's not how PowerApps evaluates dates.
So the final function was super simple:
('All-Time Quantity Out'/datediff('Transaction Date Max','Transaction Date Min'))*'Lead Time'
Thanks to all who commented
Original question below.
Recently I was given the task of figuring out our inventory at the company I work for, which includes developing processes and procedures that I can replicate across all of our branches eventually.
After a handful of videos, I have some semblance of an inventory management application built in powerapps and I've begun populating it with products in the inventory, with the hopes of eventually automating the buying process, or at least reducing the "hands in the pot" when it comes to placing orders.
Eventually, the app should be able to notify an inventory manager as stock nears/reaches set par values.
The challenge I need help with right now is this:
I have created a column in my products table (and form) that captures Lead Time (whole numbers represent days it takes on average for the product to arrive).
I want to create another column in this same table and call it Minimum Allowed Stock, which ideally should just be a formula that looks similar to this: =(sum(quantity out)/(max(transaction date)-min(transaction date)))*lead time. This would take the total quantity dispensed, divided by the days in the range to get quantity used per day, and then multiply it by the lead time so that the minimum on hand is always AT LEAST the amount expected to be consumed in the time it takes for the next order to arrive.
The issue = these transactions are in a different table, called Inventory Transactions. I am trying to create a formula column in my products table that references both my transactions table and products table, but it doesn't appear to be possible, at least the way that I am trying to do it. I can do a rollup, which allows me to reference another table (I have done this for All-Time Inventory Out/IN) but I can only do this for numbers, not dates.
Please explain why this is the worst possible way to be doing this and how there is such a better and easier way than I am trying...because this is daunting.