Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi All,
I have a scenario which requeried rolling forcast for the next three years. Please see the sample data below
Jan-22 | 34.69 |
Feb-22 | 86.72 |
Mar-22 | 64.75 |
Apr-22 | 52.9 |
May-22 | 45.37 |
Jun-22 | 45.9 |
Jul-22 | 47.27 |
Aug-22 | 44.83 |
Sep-22 | 44.86 |
Oct-22 | 43.5 |
Nov-22 | 40.49 |
Dec-22 | 37.69 |
Logic for forecasting is for Jan 23, Average of (Jan 22 to Dec 22), Feb 23 is Average of (Feb 22 to Jan 23), Mar 23 is Average of (March 22 to Feb 23) like this upto Dec 25 we need to iterate.
I got a solution in Power Query. But it would be great if there any Dax solution for this.
Thanks in Advance,
VP
Finding a non-recursive formula for this problem, even though possible, will be very, very tedious. Sadly, you can't use recursion (which would make this very easy) because DAX does not support recursion 😞
you may try
Rolling Forcast Average =
VAR CurrentDate =
MAX ( 'Date'[Date] )
VAR CurrentYear =
YEAR ( CurrentDate )
VAR LastDateWithSales =
CALCULATE ( Sales[Date], REMOVEFILTERS () )
VAR NumberOfDays =
CALCULATE ( COUNTROWS ( 'Date' ), REMOVEFILTERS (), 'Date'[Year] = CurrentYear )
VAR LastDate = CurrentDate + NumberOfDays
VAR Result =
IF (
CurrentDate <= LastDateWithSales - 365,
CALCULATE (
[Sales Amount],
REMOVEFILTERS ( 'Date' ),
'Date'[Date] <= LastDate,
'Date'[Date] > CurrentDate
)
)
RETURN
Result
Thank You!! But the rolling forecast is not happening with this query.
User | Count |
---|---|
47 | |
28 | |
23 | |
18 | |
15 |
User | Count |
---|---|
55 | |
34 | |
18 | |
17 | |
15 |