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
wmeyer
Helper III
Helper III

out of stock inventory by date and # of days out of stock

Our purchasing team's goal is to have an item go back in stock within 5 days of going out of stock. I picture having a chart similar to this to show them: 

Item            Out of Stock Date    Restock Date    # Business Days OOS

1519-DSR    3/21/17                    5/1/17                 29

                     3/8/18                      3/9/18               1     

I have a data table containing a line for every item, every day, along with columns to indicate whether an item was out of stock or in stock that day. OOS is what i have used to count the total # items in/out stock for a certain time period. OOS=1, IS=0. I've created columns for OOS Date and IS Date which look like: OOS Date = IF('Item by Day '[OOS]="1", '[qty_on_hand_date]).

I also created a column called "Last IS Date before this" which uses the formula: Last IS Date before this = SUMMARIZE(
TOPN(1,
FILTER(ALL('Item by Day '),
'Item by Day '[Yes/NoNEW]="0" &&
'Item by Day'[name]=EARLIER('Item by Day '[name])
&& 'Item by Day '[qty_on_hand_date]<EARLIER('Item by Day'[qty_on_hand_date])),
'Item by Day '[qty_on_hand_date]),
'Item by Day'[qty_on_hand_date]).

The goal of that formula was to determine the last in stock date before the item went OOS, so i could calculate the difference in days. 

 

I was thinking i would need to add the last 3 columns on the right to get the outcome i mentioned, but not sure how to do that or if it's necessary. What i have in there now is what i would like the outcome to look like.  Here is some of my data:

nameqty_on_hand_dateYes/No NEWOOSOOS DateIS DateLast IS Date before thisOut of Stock DateRestock Date# Business Days OOS
1519-DSR3/20/2017No0 3/20/2017 0:003/17/2017 0:00   
1519-DSR3/21/2017Yes13/21/2017 0:00 3/20/2017 0:003/21/20175/1/201729
1519-DSR3/22/2017Yes13/22/2017 0:00 3/20/2017 0:00   
1519-DSR3/23/2017Yes13/23/2017 0:00 3/20/2017 0:00   
1519-DSR3/24/2017Yes13/24/2017 0:00 3/20/2017 0:00   
1519-DSR3/25/2017Null   3/20/2017 0:00   
1519-DSR3/26/2017Null   3/20/2017 0:00   
1519-DSR3/27/2017Yes13/27/2017 0:00 3/20/2017 0:00   
1519-DSR3/28/2017Yes13/28/2017 0:00 3/20/2017 0:00   
1519-DSR3/29/2017Yes13/29/2017 0:00 3/20/2017 0:00   
1519-DSR3/30/2017Yes13/30/2017 0:00 3/20/2017 0:00   
1519-DSR3/31/2017Yes13/31/2017 0:00 3/20/2017 0:00   
1519-DSR4/1/2017Null   3/20/2017 0:00   
1519-DSR4/2/2017Null   3/20/2017 0:00   
1519-DSR4/3/2017Yes14/3/2017 0:00 3/20/2017 0:00   
1519-DSR4/4/2017Yes14/4/2017 0:00 3/20/2017 0:00   
1519-DSR4/5/2017Yes14/5/2017 0:00 3/20/2017 0:00   
1519-DSR4/6/2017Yes14/6/2017 0:00 3/20/2017 0:00   
1519-DSR4/7/2017Yes14/7/2017 0:00 3/20/2017 0:00   
1519-DSR4/8/2017Null   3/20/2017 0:00   
1519-DSR4/9/2017Null   3/20/2017 0:00   
1519-DSR4/10/2017Yes14/10/2017 0:00 3/20/2017 0:00   
1519-DSR4/11/2017Yes14/11/2017 0:00 3/20/2017 0:00   
1519-DSR4/12/2017Yes14/12/2017 0:00 3/20/2017 0:00   
1519-DSR4/13/2017Yes14/13/2017 0:00 3/20/2017 0:00   
1519-DSR4/14/2017Yes14/14/2017 0:00 3/20/2017 0:00   
1519-DSR4/15/2017Null   3/20/2017 0:00   
1519-DSR4/16/2017Null   3/20/2017 0:00   
1519-DSR4/17/2017Yes14/17/2017 0:00 3/20/2017 0:00   
1519-DSR4/18/2017Yes14/18/2017 0:00 3/20/2017 0:00   
1519-DSR4/19/2017Yes14/19/2017 0:00 3/20/2017 0:00   
1519-DSR4/20/2017Yes14/20/2017 0:00 3/20/2017 0:00   
1519-DSR4/21/2017Yes14/21/2017 0:00 3/20/2017 0:00   
1519-DSR4/22/2017Null   3/20/2017 0:00   
1519-DSR4/23/2017Null   3/20/2017 0:00   
1519-DSR4/24/2017Yes14/24/2017 0:00 3/20/2017 0:00   
1519-DSR4/25/2017Yes14/25/2017 0:00 3/20/2017 0:00   
1519-DSR4/26/2017Yes14/26/2017 0:00 3/20/2017 0:00   
1519-DSR4/27/2017Yes14/27/2017 0:00 3/20/2017 0:00   
1519-DSR4/28/2017Yes14/28/2017 0:00 3/20/2017 0:00   
1519-DSR4/29/2017Null   3/20/2017 0:00   
1519-DSR4/30/2017Null   3/20/2017 0:00   
1519-DSR5/1/2017No0 5/1/2017 0:003/20/2017 0:00   
1519-DSR2/16/2018No0 2/16/2018 0:002/15/2018 0:00   
1519-DSR3/5/2018No0 3/5/2018 0:003/2/2018 0:00   
1519-DSR3/6/2018No0 3/6/2018 0:003/5/2018 0:00   
1519-DSR3/7/2018No0 3/7/2018 0:003/6/2018 0:00   
1519-DSR3/8/2018Yes13/8/2018 0:00 3/7/2018 0:003/8/20183/9/20181
1519-DSR3/9/2018No0 3/9/2018 0:003/7/2018 0:00   
6 REPLIES 6
v-frfei-msft
Community Support
Community Support

Hi @wmeyer,

 

Could you please tell me what is the logic of the last three colusmn? And kindly share the full sample data to me, you can upload the file to one drive and share the link here.

 

Reagrds,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

 

Hey Frank,

I don't have logic for the last 3 columns. I added those in excel to show what I was trying to achieve there. I'm not sure if those columns are necessary or if they are the answer for helping me achieve the following chart. Maybe measures would be better for this? Any suggestions you would have for how to achieve this is appreciated!

 

Desired Outcome:            Item            Out of Stock Date    Restock Date    # Business Days OOS

                                        1519-DSR             3/21/17                    5/1/17                 29

                                                                      3/8/18                      3/9/18                 1     

Here is a link where you can download my sample file:

https://app.powerbi.com/view?r=eyJrIjoiMTE1ODZmYmItNGY3NS00YTFkLWE5MzQtOTczYjcxMGI0NWNkIiwidCI6IjcyM...

Hi,

 

Are Out of Stock and Re-stock aready there in your source dataset?  Share your data such that it can be pasted into an Excel file.  Ensure yo have the Out of Stock and Re-stock columns there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Ashish, No the Out of Stock Date and Restock Date columns are not in my data set. Like I mentioned, those are what i need help calculating. You should be able to copy and paste the table i pasted previously. I also pasted a link to a sample file you can download. Please let me know if you need anything else to help me calculate these columns. 

Hi @wmeyer,

 

Please check the following steps.

 

1. Create a date table and create 2 calculated columns in it.

 

date = CALENDARAUTO()
weekday = WEEKDAY('date'[Date])
Column = IF('date'[weekday]=1 || 'date'[weekday]=7,0,1)

2. Create a calculated column in the fact table.

 

# Business Days OOS = CALCULATE(SUM('date'[Column]),FILTER('date','Item by Day'[Out of Stock Date]<='date'[Date] && 'date'[Date]<'Item by Day'[Restock Date]))

3. Then we can get the result as we need. For more details, please check the pbix as attached.

 

Capture.PNG

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hey Frank,

Thank you for your response, the table you have in your file is exactly what i want my end result to look like, but it is not working correctly because like I mentioned, i do not have the Out of stock date, or restock date columns calculated yet. 

Were you able to download the file i attached previously? You will see a line for each item each day. What i had copy and pasted above is what i want my end result of the Out of Stock date, restock date and # businesss days OOS to look like. I need help with a formula for the Out of stock date and restock date columns. I dont want an out of stock/restock date on each line, I only want the dates to pull on the first date the item was out of stock, for each period of time it went out of stock. 

 

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.