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
henrycqc
Helper I
Helper I

Forecast upcoming delivery dates to find busy periods

Question:

Is there a better way to estimate future delivery dates based on their order frequencies?

 

Background

Our IT system only records when we receive orders.  Store orders can be daily, weekly, monthly and quarterly.

I am trying to create a report to continuously forecast the next 3 to 6 months of order dates based on the current “Most recent delivery date” field. We currently do this monthly within an excel sheet to get an estimate of upcoming deliveries. This should help us look ahead in time to spot peek weeks when a lot of orders are coming in.

 

My solution

The solution below works for monthly and quarterly delivery dates but would require a lot of new columns to replicate it for daily and weekly order dates.

 

  1. Created a reference table only hold the products the we receive monthly
    • Table field (
      • ID,
      • product,
      • Most recent delivery date)
  1. I used “Date.AddMonths” function in power query to add new Columns that estimate the next 3 months delivery dates
    • Table fields (
      • ID,
      • product,
      • Most recent delivery date,
      • Most recent delivery date + 1 month,
      • Most recent delivery date + 2 months,
      • Most recent delivery date + 3 months)
  1. I then unpivoted on ID and product columns

 

1 ACCEPTED SOLUTION
KT_Bsmart2gethe
Impactful Individual
Impactful Individual

Hi @henrycqc ,

 

I do apologise for not articulating the solution clearly.

 

Let's go back to your original question:

 


@henrycqc wrote:

Question:

Is there a better way to estimate future delivery dates based on their order frequencies?

 

 


If I understand your challenge correctly, you want to know what date has peak orders. The formula provided does the count of orders based on the frequency and the most recent delivery date for the next three months. If you apply that formula, then you will have the forecast orders for the next three months.

Also, I added a column to get the date in 3 months based on the most recent delivery date:

Date.AddMonths(Date.AddDays([#" Most recent delivery date"],-1),3)

 

I applied GroupBy then sorted by the date.

See below screenshot. Let me know if this is the desired outcome? 

 

KT_Bsmart2gethe_2-1658872860170.png

 

You can achieve the above outcome either in PQ or PP. 

 

Regards

KT

 

 

View solution in original post

5 REPLIES 5
KT_Bsmart2gethe
Impactful Individual
Impactful Individual

Hi @henrycqc ,

 

I do apologise for not articulating the solution clearly.

 

Let's go back to your original question:

 


@henrycqc wrote:

Question:

Is there a better way to estimate future delivery dates based on their order frequencies?

 

 


If I understand your challenge correctly, you want to know what date has peak orders. The formula provided does the count of orders based on the frequency and the most recent delivery date for the next three months. If you apply that formula, then you will have the forecast orders for the next three months.

Also, I added a column to get the date in 3 months based on the most recent delivery date:

Date.AddMonths(Date.AddDays([#" Most recent delivery date"],-1),3)

 

I applied GroupBy then sorted by the date.

See below screenshot. Let me know if this is the desired outcome? 

 

KT_Bsmart2gethe_2-1658872860170.png

 

You can achieve the above outcome either in PQ or PP. 

 

Regards

KT

 

 

KT_Bsmart2gethe
Impactful Individual
Impactful Individual

Hi @henrycqc ,

 

You can try to Max / MaxN function to find the TopN orders to get the date and order. Then, you can use the Duration function to find out the time length of the order placed until the next one to allow future prediction.

 

I am happy to assist your further with a set of dummy data.

 

Regards

KT

Hi

 

Our SQL database hold fields product name, product order frequency, and “most recent delivery date”, so I don’t believe that I need to use Max / MaxN and duration functions (see table A).

Table A

Product Order Frequency

 Most recent delivery date

Product A daily 25/07/2022
Product B Weekly 20/07/2022
Product C monthly 05/07/2022
Product D quarterly 16/05/2022

 

I am finding it hard to come up with an effective solution to project most recent delivery dates in the future and take account of the order frequency field.  

 

Example: If the date is 25/07/22 and I project the date from table A forward by three months, I should end up with following number of dates per product and frequency (see table B).

 

Table B (upcoming orders)

Order FrequencyCount of new rows added to account for the next 3 months of upcoming orders, exluding weekends.
Product A daily 65
Product B Weekly 13
Product C monthly 3
Product D quarterly 1

 

The dates from table B would then be used power BI visuals.

 

hope this helps.

Hi @henrycqc,

 

Add a custom column:

= if [#" Order Frequency"]="quarterly"
then 1
else
if [#" Order Frequency"]="monthly"
then 3
else
if [#" Order Frequency"]="weekly"
then Number.Abs(Number.Round(Duration.TotalDays([#" Most recent delivery date"] - Date.AddMonths([#" Most recent delivery date"],3))/7,0))
else List.Count(List.Select(List.Transform({Number.From(Date.AddDays([#" Most recent delivery date"],1))..Number.From(Date.AddDays(Date.AddMonths([#" Most recent delivery date"],3),-1))}, each Date.DayOfWeekName(_)), each _<>"Saturday" and _<>"Sunday")))

KT_Bsmart2gethe_0-1658829784961.png

 

 

Regards

KT

Hi @KT_Bsmart2gethe

 

I ‘am sorry,

I am new to the community and I have failed to clearly communicate my issue and believe that I have wasted your time.

I was trying to forecast the dates from table A to achieve table C using either power query or DAX.

Table B was meant as a summary for table C

 

Thanks for all your help.

 

Table C

Product Order Frequency Most recent delivery date
Product A daily24/10/2022
Product A daily21/10/2022
Product A daily20/10/2022
Product A daily19/10/2022
Product B Weekly19/10/2022
Product A daily18/10/2022
Product A daily17/10/2022
Product A daily14/10/2022
Product A daily13/10/2022
Product A daily12/10/2022
Product B Weekly12/10/2022
Product A daily11/10/2022
Product A daily10/10/2022
Product A daily07/10/2022
Product A daily06/10/2022
Product A daily05/10/2022
Product B Weekly05/10/2022
Product C monthly05/10/2022
Product A daily04/10/2022
Product A daily03/10/2022
Product A daily30/09/2022
Product A daily29/09/2022
Product A daily28/09/2022
Product B Weekly28/09/2022
Product A daily27/09/2022
Product A daily26/09/2022
Product A daily23/09/2022
Product A daily22/09/2022
Product A daily21/09/2022
Product B Weekly21/09/2022
Product A daily20/09/2022
Product A daily19/09/2022
Product A daily16/09/2022
Product A daily15/09/2022
Product A daily14/09/2022
Product B Weekly14/09/2022
Product A daily13/09/2022
Product A daily12/09/2022
Product A daily09/09/2022
Product A daily08/09/2022
Product A daily07/09/2022
Product B Weekly07/09/2022
Product A daily06/09/2022
Product A daily05/09/2022
Product C monthly05/09/2022
Product A daily02/09/2022
Product A daily01/09/2022
Product A daily31/08/2022
Product B Weekly31/08/2022
Product A daily30/08/2022
Product A daily29/08/2022
Product A daily26/08/2022
Product A daily25/08/2022
Product A daily24/08/2022
Product B Weekly24/08/2022
Product A daily23/08/2022
Product A daily22/08/2022
Product A daily19/08/2022
Product A daily18/08/2022
Product A daily17/08/2022
Product B Weekly17/08/2022
Product A daily16/08/2022
Product D quarterly16/08/2022
Product A daily15/08/2022
Product A daily12/08/2022
Product A daily11/08/2022
Product A daily10/08/2022
Product B Weekly10/08/2022
Product A daily09/08/2022
Product A daily08/08/2022
Product A daily05/08/2022
Product C monthly05/08/2022
Product A daily04/08/2022
Product A daily03/08/2022
Product B Weekly03/08/2022
Product A daily02/08/2022
Product A daily01/08/2022
Product A daily29/07/2022
Product A daily28/07/2022
Product A daily27/07/2022
Product B Weekly27/07/2022
Product A daily26/07/2022
Product A daily25/07/2022

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.

Top Solution Authors
Top Kudoed Authors