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.
Hi, I would like to calculate the next 3 month's forecast, but I'm having trouble with the last month for each category.
Examples:
January 3 Month Future Rolling forecast = February Forecast+March Forecast+April Forecast
April 3 Month Future Rolling forecast = May Forecast+June Forecast
The value for June should be 0, but it is showing the total forecast, and I can't figure out why. What am I missing? Also, I'm not having any luck using DATESINPERIOD with this formula.
3 Month Future Forecast = calculate(SUM('Table'[Forecast]),datesbetween(Table'[Month Reference],nextmonth('Table'[Month Reference]),dateadd('Table'[Month Reference],3,month)),filter('Table','Table'[Category]=earlier('Table'[Category])))
Based on the DAX above, this is what's being displayed
Category | Month Reference | Forecast | 3 Month Future Rolling Forecast |
A | Jan-22 | 50 | 200 |
A | Feb-22 | 50 | 250 |
A | Mar-22 | 75 | 325 |
A | Apr-22 | 75 | 250 |
A | May-22 | 100 | 150 |
A | Jun-22 | 150 | 500 |
B | Jan-22 | 200 | 500 |
B | Feb-22 | 200 | 400 |
B | Mar-22 | 200 | 300 |
B | Apr-22 | 100 | 200 |
B | May-22 | 100 | 150 |
B | Jun-22 | 100 | 900 |
C | Jan-22 | 500 | 1700 |
C | Feb-22 | 500 | 1900 |
C | Mar-22 | 600 | 2000 |
C | Apr-22 | 600 | 1400 |
C | May-22 | 700 | 150 |
C | Jun-22 | 700 | 3600 |
This is what I'm looking for - the last month of each category should be 0.
Category | Month Reference | Forecast | 3 Month Future Rolling Forecast |
A | Jan-22 | 50 | 200 |
A | Feb-22 | 50 | 250 |
A | Mar-22 | 75 | 325 |
A | Apr-22 | 75 | 250 |
A | May-22 | 100 | 150 |
A | Jun-22 | 150 | 0 |
B | Jan-22 | 200 | 500 |
B | Feb-22 | 200 | 400 |
B | Mar-22 | 200 | 300 |
B | Apr-22 | 100 | 200 |
B | May-22 | 100 | 150 |
B | Jun-22 | 100 | 0 |
C | Jan-22 | 500 | 1700 |
C | Feb-22 | 500 | 1900 |
C | Mar-22 | 600 | 2000 |
C | Apr-22 | 600 | 1400 |
C | May-22 | 700 | 150 |
C | Jun-22 | 700 | 0 |
Solved! Go to Solution.
Thanks for the responses.
After correcting the relationship with the date table, this formula worked
Thanks for the responses.
After correcting the relationship with the date table, this formula worked
Hi,
You must have a Calendar Table with a relationship from the Date column of your Data Table to the Date column of the Calendar Table. In the Calendar Table, write calculated column formulas for Year, Month name and Month number. Sort the Month name by the Month number. To your visual, drag Year and Month name from the Calendar Table. Assuming Forecast is already a measure that you have written, write this measure
3 Month Future Rolling Forecast = calculate([forecast],datesbetween(calendar[date],min(calendar[date]),edate(max(calendar[date]),3)))
Hope this helps.
Thanks so much for helping define the relationship better! I was able to correct the dax.
You are welcome.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |