Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! 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
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 84 | |
| 48 | |
| 36 | |
| 31 | |
| 29 |