Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
Hi Team,
i would like to calculate YTD and Current Month using a slicer which has "Month Name"
I was able to get Current month using the below formula=
To display current month =
var MYSELECTION=SELECTEDVALUE('Month Sorting'[Month])
return
calculate(SUM(Details[Value]),FILTER(Details,Details[Actuals_]="Actuals"),'Date Table'[Month Name]=SELECTED1).
Now to calculate YTD im finding difficult, since the slicer has month name
Ah, you'll need to translate it. You are also going to need your year, no idea about your data for that.
So, you could add something like this:
VAR __MonthNum = SWITCH(SELECTEDVALUE('Date Table'[Month Name]),
"January",1,
"February",2,
"March",3,
...
) //end SWITCH
VAR maxdate=EOMONTH(DATE(YEAR(TODAY()), __MonthNum,1),0) //current year, month number first of month, get the end of month
..
I tried using the below measure:
@Anonymous , Does your month name have Year. Then in that case if you have selected a month name from date table, the time intelligence should have worked
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))
This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD((ENDOFYEAR('Date'[Date])),"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
If the month name do not have year we have to force a year
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!