Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Would it be possible to have a filter on a visualization which allows you to select a year and includes data for the last 4 years? Like for example, if I select 2016, the visualization will include data for 2016, 2015, 2014 and 2013.
@Anonymous
Not sure what does the final visual chart like. But you can try with following steps to see if it is you expected.
YearMonth = YEAR ( 'Calendar'[Date] ) * 100 + MONTH ( 'Calendar'[Date] )
Year = YEAR ( 'Calendar'[Date] )
Year = VALUES ( 'Calendar'[Year] )
Year = YEAR ( Table1[Date] )
TotalSales =
VAR LastDay =
DATE ( MAX ( 'Year'[Year] ), 12, 31 )
VAR FirstDay =
EDATE ( LastDay, -48 )
VAR TotalSales =
SUM ( Table1[Sales] )
RETURN
IF (
MIN ( 'Calendar'[Date] ) < FirstDay,
BLANK (),
IF ( MIN ( 'Calendar'[Date] ) > LastDay, BLANK (), TotalSales )
)Best Regards,
Herbert
This is possible. For example, if I have sales data and I want to choose a year and see the last four years, my calculation might be. You just have to make use of CALCULATE and possibley FILTER. This also depends on whether you want just whole years or if you mean rolling 12 month periods. If you mean rolling periods, you would have to alter your formula and you could probably use DATESBETWEEN instead of the FILTER function in the calculation below.
Last 4 years = CALCULATE(Sum('FactInternetSales'[SalesAmount]), Filter(All('DimDate'),'DimDate'[CalendarYear] <= Max('DimDate'[CalendarYear]) && 'DimDate'[CalendarYear] > MAX('DimDate'[CalendarYear]) - 4))
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 50 | |
| 46 | |
| 35 | |
| 15 | |
| 14 |
| User | Count |
|---|---|
| 88 | |
| 76 | |
| 41 | |
| 26 | |
| 26 |