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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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