Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
geiratatea
Frequent Visitor

Rolling 12 month problem in a power bi matrix

Hi!

I am struggling on a power bi report displaying a matrix as you see below. The year-month slicer selects the yearmonths to be shown. But what I am really want is to use the date in the lowest left corner as an end date and from there show all 12 yearmonths back so I don't need to use the slicer. What I want is a measure slicer that gives me the date or YYYYMM range from in this case 202110 to 202011.

 

Now it works like this, I have to select from the periode slicer the YYYYMM and Distrikt, then I got RSPeriodeEnd field which the earliest is the one I want to use. This earliste RSPeriodeEnd must be easy to catch and then get all data 12 months back. A problem here is that there is a month table being used that connects to the fact table 

 

problem.png

 

I have tried to expand the measure called Regnskap like this but it gives me rubbish in the matrix 😞

 

Regnskap 2 =
Var currentdate = TODAY() //this should be replaced by a min rsperiodeend date
RETURN
CALCULATE([Regnskap] + 0,
DATESINPERIOD ( 'Dim_Mnd'[LastDayOfMonth], currentdate , -12, MONTH )
)

probleem1.png

 

I have looked at many pattern and have used all day on this, and I can't get the report do what I want. I hope you can help me and perhaps give a tip or two or maybe some dax code to solve this.

 

Hope to hear from you

 

regards Geir

 

NB! Is it possible to add a column to a matrix like the YYYYMM but have some other data in that column? Perhaps through a calculated table union function??
probleem1.png

1 REPLY 1
amitchandak
Super User
Super User

@geiratatea , try measure like

 

//Last 12 based on today
new measure =
var _max = eomonth(today(),0)
var _min = eomonth(today(),-12)+1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))

 

 

hope you have date table and it is not filtered

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors