Forum Discussion
Anonymous
1 year agoNot applicable
Dynamic date slicer
Hello! First time poster: I am trying to make a date slicer, but I want the date to be dynamic, depending on another piece of information (earliest villain date): I want to have a graph o...
- 1 year ago
Okay, see attached file for a solution:
Add a Custom Column to your data table using Power Query > Add Column > Custom Column
Duration.Days( [Run in with Cops] - [Earliest Villain Date])Then create a new measure:
Run in is within Selected Time Period = VAR _DaysWithin = SELECTEDVALUE( 'Time Slicer'[Days] ) VAR _Result = COUNTROWS( FILTER( 'Table', ABS('Table'[Days Since Earliest Villain Date]) <= _DaysWithin) ) RETURN IF( MAX( 'Table'[Days Since Earliest Villain Date] ) = BLANK(), BLANK(), _Result )I also added a date table for good practice, but you don't need it yet here: https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html
AllisonKennedy
1 year agoCommunity Champion
Anonymous I'm working on a response for you - in future if you can paste the sample data in tabular format, for example:
| Identifying number | Name | Earliest Villain Date | Run in with Cops |
| 54701 | Big Bad Wolf | 7/26/2024 | 5/01/2024 |
| 10 | Three Bears | 5/02/2024 | 5/02/2024 |
| 2024 | Darth Vader | 5/11/2024 | |
| 24246 | Jafar | 5/12/2024 | |
| 54701 | Big Bad Wolf | 7/26/2024 | 6/05/2024 |
| 10 | Three Bears | 5/02/2024 | 6/10/2024 |
| 54701 | Big Bad Wolf | 7/26/2024 | 6/11/2024 |
| 54701 | Big Bad Wolf | 7/26/2024 | 6/15/2024 |
| 24246 | Jafar | 6/16/2024 | |
| 64844 | Ursela | 6/16/2024 | 6/16/2024 |
| 1492 | Pete | 6/21/2024 | |
| 24246 | Jafar | 7/01/2024 | |
| 54701 | Big Bad Wolf | 7/26/2024 | 7/26/2024 |
| 10 | Three Bears | 5/02/2024 | 5/02/2024 |
| 2024 | Darth Vader | 8/11/2024 | |
| 24246 | Jafar | 8/12/2024 | |
| 54701 | Big Bad Wolf | 7/26/2024 | 8/12/2024 |
| 10 | Three Bears | 5/02/2024 | 8/14/2024 |
| 54701 | Big Bad Wolf | 7/26/2024 | 8/15/2024 |
| 54701 | Big Bad Wolf | 7/26/2024 | 8/18/2024 |
| 24246 | Jafar | 8/19/204 | |
| 64844 | Ursela | 6/16/2024 | 8/19/2024 |
| 1492 | Pete | 8/19/2024 | |
| 24246 | Jafar | 8/20/2024 | |
| 54701 | Big Bad Wolf | 7/26/2024 | 8/20/2024 |
| 10 | Three Bears | 5/02/2024 | 8/21/2024 |
| 2024 | Darth Vader | 8/21/2024 | |
| 24246 | Jafar | 8/22/2024 | |
| 54701 | Big Bad Wolf | 7/26/2024 |
8/22/2024 |
It makes it much easier for us to support you in a way that's super easy for you to implement.