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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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).
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 35 | |
| 34 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 137 | |
| 102 | |
| 68 | |
| 66 | |
| 64 |