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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Date in title to change dynamically to show last 12 months from selected date

Hi Experts

 

Need a measure that give the last 12 months based on the selected date in Slicer.

Assume i select Mar 21 in the Slicer.

Then i want the measure to show Feb 20 - Mar 21 i want to use this in a title

 

If i Select Feb 21 from Slicer 

Then i want the measure to show Jan 20 - Feb 21 and so on

Sample File

https://www.dropbox.com/s/bi1woiapsgx8p4v/v1.3.pbix?dl=0 

1 ACCEPTED SOLUTION

@Anonymous , Sorry , Try like

New measure =
var _max = maxx(allselected('Date', 'Date'[date])
var _min = eomonth(_max,-12)

 

return

format(_min ,"mmm YY") & " to " & format(_max ,"mmm YY") 

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

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , Try like

 

New measure =
var _max = maxx(allselected('Date', 'Date'[date])
var _min = eomonth(_max,-12)
return
calculate(sum(Table[Value]), filter(all('Date'), 'Date'[date] >=Min && 'Date'[date] <=_max && Date[Date] <=max(Date[Date])))

 

 

or

One of the three

 

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-12,MONTH))
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX(Sales[Sales Date]),-12,MONTH))
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

 

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
Anonymous
Not applicable

Hi Amit.. How would that give me.... as a text string  if i Select Mar 12 on Slicer ("Feb 20 to Mar 21")

 

@Anonymous , Sorry , Try like

New measure =
var _max = maxx(allselected('Date', 'Date'[date])
var _min = eomonth(_max,-12)

 

return

format(_min ,"mmm YY") & " to " & format(_max ,"mmm YY") 

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
Anonymous
Not applicable

Thanks you sir.....Did you manage to look at the Tooltip one please.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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