Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have a custom date range. what I want is If someone select last 30 days, Last Month, This month so i have calculated the start date and enddate Accordingly based on users selection that will be applied to entire page and the custom date slicer as well
Could you please try below Steps:
1. Create Helper table (for the slicer):
DateRange = DATATABLE("Option", STRING,
{{"Last 30 Days"},{"Last Month"},{"This Month"}})
2. Two measures:
StartDate =
SWITCH( SELECTEDVALUE(DateRange[Option]),
"Last 30 Days", TODAY() - 30,
"Last Month", EOMONTH(TODAY(),-2) + 1,
"This Month", EOMONTH(TODAY(),-1) + 1)EndDate =
SWITCH( SELECTEDVALUE(DateRange[Option]),
"Last 30 Days", TODAY(),
"Last Month", EOMONTH(TODAY(),-1),
"This Month", TODAY())
3. One filter measure:
InRange =
VAR s = [StartDate]
VAR e = [EndDate]
RETURN IF( MAX('Date'[Date]) >= s && MAX('Date'[Date]) <= e, 1, 0 )
4. Put DateRange[Option] as a slicer >> add InRange = 1 in the page/visual filter pane.
Now picking an option updates the entire page (and any custom date slicer that’s bound to your Date table).
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.