Forum Discussion
Naveen29
3 years agoHelper II
DAX
I have a requriment creating slicers as like below.
when users selects the slicer 1 , accordinly the slicer2 values should display.
| Period (slicer1) | Slicer2 | Data should be |
| Weekly | Week start date - End date along with Year/Month | Ex: 2022/Augu8th- August12th |
| Monthly | Year\Month | 2022 | August |
| Yearly | Year\Month | 2022 |
1 Reply
- AnonymousNot applicable
Hi Naveen29 ,
You can refer the following links to get it:
Custom Range Date Slicer in Power BI with dynamic defaults and more...
SpecialDates = VAR _datetable = CALENDAR (DATE(2022,1,1), DATE(2022,12,31)) 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) RETURN UNION( ADDCOLUMNS(FILTER(_datetable,[Date]=_today),"Period","Today","Order",1), ADDCOLUMNS(FILTER(_datetable,[Date]=_today-1),"Period","Yesterday","Order",2), ADDCOLUMNS(FILTER(_datetable,[Date]>_today-7),"Period","Last 7 Days","Order",3), ADDCOLUMNS(FILTER(_datetable,[Date]>=_thismonthstart),"Period","This Month","Order",4), ADDCOLUMNS(FILTER(_datetable,[Date]>=_thisquarterstart),"Period","This Quarter","Order",5), ADDCOLUMNS(FILTER(_datetable,[Date]>=_thisyearstart),"Period","This Year","Order",6), ADDCOLUMNS(FILTER(_datetable,[Date]>_today-30),"Period","Last 30 Days","Order",7), ADDCOLUMNS(_datetable,"Period","Custom...","Order",8) )Custom Date Period Selections in Power BI
Create a time period table DAX
If the above one is not what you want, please provide more details on the function or logic of "cascading" slicers. Thank you.
Best Regards