Forum Discussion
DAX Forecasting help
- 4 years ago
Hi cottrera ,
It is certain that there is a problem with your filter conditions.
First, dax only calculate with the data which already existing, WIP calculates depend on itself which not existing.
But this don't mean it impossible to forecast the WIP. We can easily find that
the next WIP = current WIP + sum( current Variance)/2
after the next WIP = current WIP + sum( current Variance + the next Variance )/2
second after the next WIP = current WIP + sum( current Variance + the next Variance + after the next Variance )/2
...
So we should construct a cache table to calculate.
Try the following code to create a measure:
Forecast WIP M = VAR _firstrow = TOPN( 1, FILTER( ALL( 'Table' ), NOT ( ISBLANK( [WIP] ) ) ), [Month], DESC ) VAR _lastMonth = CALCULATE( MAX( 'Table'[Month] ), _firstrow ) VAR _lastWIP = CALCULATE( MAX( 'Table'[WIP] ), _firstrow ) VAR _sumVar = SUMX( FILTER( ALL( 'Table' ), [Month] >= _lastMonth && [Month] <= SELECTEDVALUE( 'Table'[Month] ) ), [Variance] ) / 2 VAR _forecast = _lastWIP + _sumVar RETURN IF( SUM( 'Table'[WIP] ) = BLANK(), _forecast, SUM( 'Table'[WIP] ) )Result:
Pbix in the end you can refer.
Best RegardsCommunity Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Chenwu zhu
thank you for responding so quickly. The table example I provided was a visual table. This is feed by my model that is made up of a number of other tables. Therefore I was unable to edit your dax function to suite my model. Below is an example of the model as you can see the WIP , forecast jobs,Logged jobs, completed jobs all come from seperate tables
thank you
Richard
Hi cottrera ,
I gave some calculation ideas because I saw that yours was provided as a visual screenshot.
It is indeed difficult to match your model. If you can reproduce this table in a new table, with the code above, it would be easy.
or provide pbix file without sensitive data.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.