Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
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.
Solved! Go to Solution.
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
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.
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
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.
FORMAT(EDATE(DATES[DATE],-12),"MMM YYYY")
I would want that since its not just that. i want it to show for other measures as well. What would be the code?
That's a lot of code. Have you considered using SAMEPERIODLASTYEAR instead?
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
CurrentMonthLastYearCount =
CALCULATE( SUM(Query1[NewCount]), SAMEPERIODLASTYEAR(Dates[Date]))
This assumes that you have a proper calendar table "Dates" is your data model.
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
20 | |
12 | |
10 | |
10 | |
8 |
User | Count |
---|---|
20 | |
13 | |
9 | |
7 | |
7 |