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
annaka05
Helper I
Helper I

Display data from last 12 monts from selection slicer

Hi, 

I am creating report, displaying sales data for each month from selected date range. I have created date table. I would like to change it a little: date slicer will have only one date to choose and report will show data from last 12 months from choosen date. Anybody can help?

pb.png

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@annaka05 , you need the slicer to be on an independent date table for that

 

//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -12) +1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))

 

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

View solution in original post

3 REPLIES 3
annaka05
Helper I
Helper I

Hello @amitchandak!

I have one more question. Your solution is almoust all what I need, but can I change one more thing. Is it possible to show previous 12 months data, but from end of month based on date selected in slicer? Now it shows previous 12 months, but last month shows only sales of selected date. So, when I have selected e.g. 2022/11/05 on slicer, last month sales shows only sales till this date. I would like to change it, that I will choose this date, I will see sales till end of November 2022.

 

Regards,

Anna

amitchandak
Super User
Super User

@annaka05 , you need the slicer to be on an independent date table for that

 

//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -12) +1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))

 

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

@amitchandak Thank you a lot! 

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