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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
powerbidverdon
Frequent Visitor

Calculate Shortage Date

Hello community, thank you for taking the time to help my learning 🙂

 

Problem:

Need to calculate the date when my stock level is zero or less.

 

I have the following 3 tables all connected to an Index Table by the column Key. Column Key is just all possible combinations of Item Number and Date, for example "AAA-29/11/2022"

Schermafbeelding 2022-11-29 124120.png

 

I would like to calculate the date when my item stock level is zero or less.

 

For example:

I have item AAA. From the Quantity On Hand table I see I have 5 pcs in stock on 29th Nov (Date is just todays date ). In the Requirements table I see i require 4 pcs on 30 Nov , 3 pc on 1 Dec and 5 pcs on 2 Dec. In the Purchase Orders table I have a Purchase order coming in on 30 Nov of 3 pcs and another on 1 Dec of 1 pc.

Explanation in table form below

DateItemOn HandReqOn OrderAdj Stock
29 Nov (today)AAA5  5
30 NovAAA 434 (5-4+3)
1 DecAAA 312 (4-3+1)
2 DecAAA 5 -3 (2-5)

 

For AAA I would like the calculation to give me as result the date 2 Dec as it is the earliest date when stock level is >= 0 pcs.

 

Using this measure I would like the table visualisation output to look like this

Item NumberIventory run out date
AAA2 Dec 2022
BBB15 Jan 2023
CCC4 Jan 2023
DDD15 Feb 2023
.........

 

I can't see to get my head round how to do this. I think I need to create loop to find when running adjusted stock reaches zero or less but is this possible in Dax?

 

Thanks!

4 REPLIES 4
franco28
New Member

Hi @powerbidverdon,

 

I was wondering whether you could find a solution for your problem. I am trying to achieve something very similar.

Thank you in advanced.

v-jayw-msft
Community Support
Community Support

Hi @powerbidverdon ,

 

Have trouble to follow.

Can you explain how you got the desired result from the data you have?

 

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Hello Amit,

 

 Thanks for the feedback.

Unfortunately both suggestions would not work in my case.

-radaclad solution does not give me back the Date the part will be short. It simply gives a running total which I am already doing today. The solution is also just efficient for a couple of product IDs produced in a matrix. I am looking for a simple table as below for potentially 1000s of items.

Required ouput

Item NumberIventory run out date
AAA2 Dec 2022
BBB15 Jan 2023
CCC4 Jan 2023
DDD15 Feb 2023
..... (1000 more item numbers)....

 

-the second solution also seems to be modeled on product inventory whereas mine is based on purchasing parts for production (demand requirement). It is also using running total and it is looking at a part by part level, it is not feasible for a solution where i would like a table listing around 1000 parts and in another column the day the part will be out of stock (see solution table above).

 

thanks

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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