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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Monteiro8029
New Member

How to dynamically change the date range on a slicer with a calculation item which display n months

Hi Guys,

I have created a dashboard where the requirement was to display the last 12 months(using calculation item) on all visualizations after a refresh. I was able to implement the solution and it is working perfectly fine. My Dashboard also consists of a Date slicer which, when selected, the visuals are responsive. However, when the calculation item is set to the last 12 months, I see the last 12 months on all my visuals, but the date slicer wouldn't change. The Date slicer range is set for all time which is functional and I can change my date range accordingly. But when I select the 12 months Calculation item, the date range should be set to 12 months, and Functional to select dates prior to it. 

I am trying to fix it, as it looks like a bug to the end user.
Hope I can get help and fix this issue.

1 REPLY 1
amitchandak
Super User
Super User

@Monteiro8029 , Create a measure that can filter dates and use that visual level filter on date range slicer

 

In case you are looking for 12 month trend based on selected value. The slicer need to be on an indepedent table

//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))

 

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.