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 August 31st. Request your voucher.

Reply
homelander123
Helper I
Helper I

Dynamic name

CurrentMonthLastYearCount =
VAR SelectedMonth = MAX(Query1[SetupDate])
VAR LastYearSameMonthStart = EOMONTH(SelectedMonth, -13) + 1
VAR LastYearSameMonthEnd = EOMONTH(SelectedMonth, -12)
VAR Result = CALCULATE( SUM(Query1[NewCount]), Query1[SetupDate] >= LastYearSameMonthStart && Query1[SetupDate] <= LastYearSameMonthEnd )
RETURN
Result

I am using this DAX however i want the name to be dynamic based on slicer selection. 
E.g. if i select feb 2025, it should show feb 2024. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Your solution is so great Punithurs and lbendlin 

Hi, @homelander123 

I think you can refer to this blog post from the community below:

Dynamic titles in Power BI - Microsoft Fabric Community

vjianpengmsft_0-1739866680100.png

 

 

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Your solution is so great Punithurs and lbendlin 

Hi, @homelander123 

I think you can refer to this blog post from the community below:

Dynamic titles in Power BI - Microsoft Fabric Community

vjianpengmsft_0-1739866680100.png

 

 

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

lbendlin
Super User
Super User

FORMAT(EDATE(DATES[DATE],-12),"MMM YYYY")

homelander123
Helper I
Helper I

I would want that since its not just that. i want it to show for other measures as well. What would be the code?

lbendlin
Super User
Super User

That's a lot of code.  Have you considered using SAMEPERIODLASTYEAR  instead?

Punithurs
Frequent Visitor

Hi @homelander123 , 

Hope your Question is to show the title dynamically when a slicer selection is made, 

Measure =
VAR SelectedMonth = MAX(Query1[SetupDate])
VAR LastYearSameMonthStart = EOMONTH(SelectedMonth, -13) + 1
RETURN 
FORMAT(LastYearSameMonthStart,"MMM") & " " YEAR(LastYearSameMonthStart)


Use this Measure as function in visual title. 
If this is not what your looking for, please elobrate your ask. 

Thanks,
Punith




@Punithurs It says syntax incorrect

CurrentMonthLastYearCount =
CALCULATE( SUM(Query1[NewCount]), SAMEPERIODLASTYEAR(Dates[Date]))

This assumes that you have a proper calendar table "Dates"  is your data model.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.