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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
This is my input file, having more than 24 months and more than a dozen countries of data.
Now I want to create a matrix in the PBIX, with 12 months of trailing data from a date slicer.
That is, I will have a date slicer and I would like to see the previous 12 months of data from the selected month.
For example, if I select Jan'21 in my slicer I want the matrix to have data from Jan'21 to Feb'20(12 months) and if I select Nov'20 I want the matrix to show data from Nov'20 to Oct'19(12 months).
I have tried implementing this in Table visual and it works fine in table visual. It even works in the matrix till I don't have rows, as soon as I drag the Class column in the Rows section it does not work.
Thank you. Any help would be appreciated.
Solved! Go to Solution.
Hi @Anonymous ,
Try the following formula:
Measure =
var SelectDate = MAX('Calendar'[Date])
var RollingMonths =
CALCULATETABLE(
DISTINCT('Calendar'[Month-Year]),
FILTER(
ALL('Calendar'),
'Calendar'[Date] <= SelectDate
&& 'Calendar'[Date] > EOMONTH(SelectDate,-12)
)
)
return
COUNTROWS(
INTERSECT(
RollingMonths,
DISTINCT('Table'[Date])
)
)
Then filter Date column in matrix by Measure.
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous
Refer to the video from sqlbi.com:
https://www.youtube.com/watch?v=d8Rm7dwM6gc&t=1s
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 202 | |
| 130 | |
| 102 | |
| 71 | |
| 55 |