Forum Discussion
Forecast data display
To meet your requirement, follow these steps:
1. **Create a Date Slicer
Ensure the date slicer uses the Date table which includes the full range from the minimum date in the current table to the maximum date in the forecast table.
2. Adjust the Date Slicer Logic
Create a measure to handle the logic of displaying data for the current year and the next two years when the current year is selected.
3. Create a Custom Measure
Use a DAX measure to check if the selected date is in the current year and then include the forecast for the next two years.
```DAX
SelectedYear = YEAR(TODAY())
DisplayData =
IF (
YEAR(MAX(DateTable[Date])) = SelectedYear,
CALCULATE (
SUM(MergedTable[Value]),
YEAR(MergedTable[Date]) IN {SelectedYear, SelectedYear + 1, SelectedYear + 2}
),
SUM(MergedTable[Value])
)
```
4. Use the Measure in Your Visualization
Replace the existing measure in your visuals with `DisplayData`.
5. Test the Slicer
Ensure that selecting the current year in the slicer shows data for the current year along with the forecast for the next two years.