Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
leletran
Frequent Visitor

Building a time phased inventory

Hello all,

 

I hope I'm not in over my head with this, but I'm trying to build a time phased inventory that will calculate available total quantity after an order is placed, with new orders subtracting from the available quantity. 

 

Looking at this screenshot, we have 22 orders for Item 110000-100. The total quantity we have available on hand is 1,610. With subsequent orders, it subtracts from the available quantity.

Screenshot 2023-07-11 at 6.22.22 PM.png

 

I have two tables I'm working with: the customer orders table and the item warehouse table (this table contains the available on-hand). I've created a conditional column where if the item and the warehouse matches between the customer orders table and the item warehouse table, then subtract Quantity Ordered from QtyOnHand:

Screenshot 2023-07-12 at 10.29.52 AM.png

 

Unfortunately, while this does give me the available quantity, it doesn't iterate to the next order with the same item and I'm not sure what to do next:

Screenshot 2023-07-12 at 10.33.57 AM.png

 

Ultimately, I'd for the result to look something like this: first order on 3/16 with 13 quantity ordered. So 1,610 - 13 = 1597 available on hand. Next order, 60 was ordered, so 1597 - 60 = 1537, and so on. 

Screenshot 2023-07-12 at 10.21.07 AM.png

I hope this is actually feasible. Any insight is greatly appreciated. Thank you!

 

Cheers,

Lele

2 ACCEPTED SOLUTIONS

Hi @leletran ,

This is because your "OrderDate" column have duplicated values, please try to add an Index column in PowerQuery pane, then modify your dax formula with "Index" column.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Okay, got it! Used the wrong operator and had unnecessary syntax. 😁

leletran_0-1689350943807.png

leletran_1-1689350970819.png

 

View solution in original post

4 REPLIES 4
leletran
Frequent Visitor

After a pot of coffee and lots of pacing back and forth, I'm a bit closer. It's now using the updated available quantity on subsequent orders, but this works when the OrderDate is unique. When there are multiple orders with the same date, while the available quantity is correct, it's show the same quantity number for these non-unique dates.

 

Looking at orders placed on 7/5 as an example, 1470 is correct (1497 - 27 = 1470), but this is confusing.

I'd like for this to show 7/5 - 1 quantity ordered - remaining 1496
7/5 - 18 quantities ordered - remaining 1478

7/5 - 8 quantities ordered - remaining 1470

leletran_0-1689198453865.png

 

DAX formula: 

leletran_1-1689198732300.png

 

Figured out one problem, now stuck on another. Sigh...

Hi @leletran ,

This is because your "OrderDate" column have duplicated values, please try to add an Index column in PowerQuery pane, then modify your dax formula with "Index" column.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-binbinyu-msft,

 

Many thanks for your response! I was actually playing around with an Index column yesterday but could not get the query to work. I used the Index column option in Power Query (From 1 option if that matters?), and created a new measure and the numbers don't look right.

 

Time-Phased Quantity 4 is the new measure using Index column

leletran_0-1689342088084.png

DAX:

leletran_1-1689342228615.png

 

I revised again to use OrderDate and Index and received the same result as previous screenshot:

leletran_2-1689342374513.png

 

The OrderDate is important since it helps determine which transaction happened first, but I'm afraid I'm stuck trying to incorporate both OrderDate and Index in the formula. I'm sure I'm missing something incredibly silly. Thank you so much for your time and help! 

 

Cheers,

Lele

 

 

 

Okay, got it! Used the wrong operator and had unnecessary syntax. 😁

leletran_0-1689350943807.png

leletran_1-1689350970819.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.