We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi all, I have been searching high and low for a way to populate a column of forecasted values using DAX. Other than forecasting by moving average, I have not been able to find any methods to perform exponential smoothing forecasting using DAX.
I am currently exploring ways to do so on Query Editor. Assume I have the following simple dataset. How do I populate a column containing the forecasted numbers?
Here is the PBIX file:
https://www.dropbox.com/s/wc30mt5kron382t/Inventory%20Forecasting.pbix?dl=0
Thank you!
Hi @Anonymous,
The Exponential Smoothing is a little complicated. There could be a solution here by R.
# 'dataset' holds the input data for this script
temp <- dataset
temp$Date <- as.Date(temp$Date, '%Y-%m-%d')
es <- c()
minDate <- temp$Date[1]
ds_length <- length(temp$Date)
for (index in c(1:ds_length)) {
if (temp[index,1] == minDate) {
st <- temp[index, 3]
}
else {
st <- 0.2 * temp[index, 3] + (1 - 0.2) * es[index - 1]
}
es[index] <- st
}
temp$es <- es
Best Regards,
Dale
Could you please clarify how to make this code reusable to just replace parameters (Date, Value)?
when I executed this code I received an error
(Error in if (temp[index, 1] == minDate) { :
missing value where TRUE/FALSE needed
Execution halted
)
Also, @v-jiascu-msft how do I forecast for the following year? Could you share the code for me (I don't know R language yet)? The calculation you provided only allows for forecasting in the same period.
anyone?
Thank you @v-jiascu-msft! Could you suggest me some resources to learning R on Power BI?
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 57 | |
| 38 | |
| 32 | |
| 18 | |
| 16 |
| User | Count |
|---|---|
| 66 | |
| 66 | |
| 39 | |
| 34 | |
| 25 |