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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Whitewater100
Solution Sage
Solution Sage

DAX Help on Factoring in Lead Time for Forecasting

https://drive.google.com/file/d/1XVKJH_Gzi6ouiAezwefRyFVtw49gtE7k/view?usp=sharing 

 

Hello:

 

I am hoping to get some input on revising this forecast measure to account for a SelectedValue for lead time. If a lead time choosen is for 30 days, then the upcoming forecast would not be able to be altered for 30 days. After the 30 days the "Adjusted" forecast can be added to the actual sales which have occured. In the picture below the lead time is for 30 days. This means the month of September would stay at &74,875 (orange highlight) but Oct-Dec can change to the green highlight. I will paste my measure below and I believe it just needs a clause that just maintains the initial forecast for as many days that are selected for lead time, then the forecast can be adjusted. I have included the pbix I made via link, Thank you!

PS. [EC Sales Demo] is just a sales measure.

 

Whitewater100_0-1641825600961.png

Adj '21 FCast QUESTION =
VAR LastOrderDate =
CALCULATE(
MAX( 'ecomm_Sls_FC_Comp'[transaction_date] ),
ALL( 'ecomm_Sls_FC_Comp' )
)
VAR AdjustedForecast =
SUMX(
'Dates',
IF(
'Dates'[Date] <= LastOrderDate,
[EC Sales Demo],
                         // I beleive this is where the additional logic would go
[Total '21 Budget] *(1 + [FCast Adj %])
)
)
RETURN
AdjustedForecast

 

1 ACCEPTED SOLUTION
Whitewater100
Solution Sage
Solution Sage

I ended up solving this. In case the solution is helpful to others:

 

Adj '21 FCast QUESTION =
VAR LastOrderDate =
CALCULATE(
MAX( 'ecomm_Sls_FC_Comp'[transaction_date] ),
ALL( 'ecomm_Sls_FC_Comp' )
)
VAR fixedfrozenhorizon = CALCULATE(
[Total '21 Budget],
DATESINPERIOD(Dates[Date],
MAX(ecomm_Sls_FC_Comp[transaction_date]),
SELECTEDVALUE('Lead Time'[Value]),DAY))
VAR LeadTimeDays = SELECTEDVALUE('Lead Time'[Value], 30)
VAR AdjustedForecast =
SUMX(
'Dates',
IF(
'Dates'[Date] <= LastOrderDate,
[EC Sales Demo],
IF(
'Dates'[Date] > LastOrderDate + LeadTimeDays,
 
[Total '21 Budget] *(1 + [FCast Adj %]),
[Total '21 Budget])
)
)
 
RETURN
AdjustedForecast

View solution in original post

1 REPLY 1
Whitewater100
Solution Sage
Solution Sage

I ended up solving this. In case the solution is helpful to others:

 

Adj '21 FCast QUESTION =
VAR LastOrderDate =
CALCULATE(
MAX( 'ecomm_Sls_FC_Comp'[transaction_date] ),
ALL( 'ecomm_Sls_FC_Comp' )
)
VAR fixedfrozenhorizon = CALCULATE(
[Total '21 Budget],
DATESINPERIOD(Dates[Date],
MAX(ecomm_Sls_FC_Comp[transaction_date]),
SELECTEDVALUE('Lead Time'[Value]),DAY))
VAR LeadTimeDays = SELECTEDVALUE('Lead Time'[Value], 30)
VAR AdjustedForecast =
SUMX(
'Dates',
IF(
'Dates'[Date] <= LastOrderDate,
[EC Sales Demo],
IF(
'Dates'[Date] > LastOrderDate + LeadTimeDays,
 
[Total '21 Budget] *(1 + [FCast Adj %]),
[Total '21 Budget])
)
)
 
RETURN
AdjustedForecast

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.