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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello, I wish to use the date column in my table to create MTD,YTD to be used in a slicer to filter the visual.
Kindly guide me on how tpo create the measures.
What i wish to to is to be able to filter my line graph visual with a slicer that has MTD,YTD instead of filtering by selecting dates in a date slicer.
@Anonymous So, you will need a disconnected table with your slicer values and then a measure like this:
Measure =
VAR __Selected = SELECTEDVALUE('SlicerTable'[Value])
VAR __Year = YEAR(TODAY())
VAR __Month = MONTH(TODAY())
VAR __Start = IF(__Selected = "MTD", DATE(__Year,__Month,1), DATE(__Year, 1, 1))
VAR __End = TODAY()
RETURN
SUMX(FILTER('Table',[Date]>=__Start && [Date]<=__End), [ADSMI])
Thanks Greg for the prompt reply, this does work and give me a MTD or YTD sum. But what i wish to do is plot the data set against date values and to be able to filter that graph by single click selecting MTD or YTD, that results in a MTD graph or YTD graph. Right now i can use the slicer with date coulumn to mauannly select the date range. but I want to be abe to single click select the Month to Date range or Year to Date range. Something like in the image below;
@Anonymous So like this?
Measure =
VAR __Selected = SELECTEDVALUE('SlicerTable'[Value])
VAR __MaxDate = MAX('Table'[Date])
VAR __Year = YEAR(__MaxDate)
VAR __Month = MONTH(__MaxDate)
VAR __Start = IF(__Selected = "MTD", DATE(__Year,__Month,1), DATE(__Year, 1, 1))
VAR __End = __MaxDate
RETURN
SUMX(FILTER('Table',[Date]>=__Start && [Date]<=__End), [ADSMI])
Hey Greg,
As you can see I have managed to create a measure that can slicer the visual based on the selection i make on the Select Index slicer.
Firstly, as you can see from my measure, the alrnate result is Blank(), what can i do so that if nothing is selected, all the indexes are selected and the graph shows all the lines together.
Secondly, What i seek to achive further is to create a measure that will slice the x-axis(date) based on the selected value in the select period slicer. Like it should show date range only for 1 month back from today if i select 1 Month and so on.