This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
I have 4-5 visuals on a dashboard from Sales Data table. I have a year slicer on the same dashboard. I have sales data in a visual & I want that it should show data of last 2 years of slicer selected year, slicer selected year & next 2 years of slicer selected year. Means If the slcier has year selected as 2019, the visual should show data of 2017, 2018, 2019, 2020 & 2021.
I have data as below-
Sales Data table
Column 1- Order date
Column 2- Order Year
Column 3- Sales
I tried below measure but it is not filtering other visuals. I want that the sales data should reflect of previous 2, current & future 2 years but other visuals should also change & show data of slicer selected year.
So far...
I created a calendar table as below & connected its Date column with Order date column of Sales Data table.
I created a year table as below
Then I created a mesure as
Solved! Go to Solution.
I sent you an email yesterday, didn't you receive it?
When you said the above was not helping, what did it return? I don't see you can put SELECTEDVALUE in FILTER like this. Your slicer 'Year'[Year] is a disconnected one from your Sales Data table?
5 yr sales data =
VAR CurYear = SELECTEDVALUE('Year'[Year])
RETURN
CALCULATE(SUM(Sales Data table[Sales]),FILTER('Calendar','Calendar'[Year]<= CurYear+2 &&'Calendar'[Year]>=CurYear-2))
Hi @Anonymous
Thanks a lot for your help.
It returned correct sales values as expected when I was using year values from Year table in slicer. Like when i selected yeat 2019, it gave me data of 2017, 2018, 2019, 2020 & 2021 however it has not changed the value of other visuals which data is derived from Sales data table only. I added year values from Sales table in slicer (after connecting Sales data table with Year column of Year table) but then it works on other visuals but then it doesn;t provide me Sales data of last & next two years.
If I understand it correctly, the Year table is disconnected, then it works in the 5-year sales, but other visuals won't work; if it is connected, then other visuals work but 5-year sales not. How about using your connected Calendar instead?
5 yr sales data =
VAR CurYear = SELECTEDVALUE('Calendar'[Year])
RETURN
CALCULATE(SUM(Sales Data table[Sales]),FILTER(ALL('Calendar'[Year]),'Calendar'[Year]<= CurYear+2 &&'Calendar'[Year]>=CurYear-2))
Thanks a lot @Anonymous for your reply. I tried this on my file but then it provides value of the single year. Will u be able to explain this in a PBIX file, only if you have time 🙂
Agree with @aj1973 , it is better that you share a sample .pbix file. My dummy data is simply a fact table with a connected Calendar table, nothing else. Not sure why the measure not working in your model as we don't know your model.
@Anonymous Actually Mam, I tried uploading file earlier but my organisation doesn;t allow me to uplaod the files in external portal & so I can;t do that mam. It will be very helpful if you spare sometime & share apBIX file with some dummy data 🙂
We have conversation but no progress, sent you my email in pm if you want to share a sample file.
@Anonymous Have sent PM to you mam. Thanks for all your help.
Hi @Anonymous I got it mam. It was in spam folder. Thanks a lot for all yuor help. Will check the email now.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 30 | |
| 24 | |
| 23 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 61 | |
| 35 | |
| 33 | |
| 23 | |
| 23 |