Forum Discussion
Vanessa250919
Helper V
5 years agoTable Date custom
Hello all, I used this formula in dax to have a slicer date custom, I need another choice in my slicer this chose start with a date in a column in my _Mastertable and ending with another column it's possible ?
SpecialDates =
VAR _datetable = DIM_CALENDAR
VAR _today = TODAY()
VAR _month = MONTH(TODAY())
VAR _year = YEAR(TODAY())
VAR _thismonthstart = DATE(_year,_month,1)
VAR _thisyearstart = DATE(_year,1,1)
VAR _lastmonthstart = EDATE(_thismonthstart,-1)
VAR _lastmonthend = _thismonthstart-1
VAR _thisquarterstart = DATE(YEAR(_today),SWITCH(true,_month>9,10,_month>6,7,_month>3,4,1),1)
VAR _MasterTable = MASTERTABLE
RETURN UNION(
ADDCOLUMNS(FILTER(_datetable,[Date Range]=_today),"Period","Today","Order",1),
ADDCOLUMNS(FILTER(_datetable,[Date Range]=_today-1),"Period","Yesterday","Order",2),
ADDCOLUMNS(FILTER(_datetable,[Date Range]>_today-7),"Period","Last 7 Days","Order",3),
ADDCOLUMNS(FILTER(_datetable,[Date Range]>=_thismonthstart),"Period","This Month","Order",4),
ADDCOLUMNS(FILTER(_datetable,[Date Range]>=_thisquarterstart),"Period","This Quarter","Order",5),
ADDCOLUMNS(FILTER(_datetable,[Date Range]>=_thisyearstart),"Period","This Year","Order",6),
ADDCOLUMNS(FILTER(_datetable,[Date Range]>_today-30),"Period","Last 30 Days","Order",7),
ADDCOLUMNS(_datetable,"Period","Custom...","Order",8)
)
1 Reply
- lbendlin
Super User
Vanessa250919 How do you expect the user to specify the date range for the custom choice? Have you considered using the filter pane instead, and allow the users to choose advanced filters?