Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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 on the report view that gives each Identifying number as a choice
When you click on that, I have measures to show how many "Run in with cops" before and after the "Earliest villain date"
What I want to do now, is be able to add a slicer based on their "Villain date" to zoom in on the month, 6 months and year surrounding their "Villain date".
Each villain date is unique to the ID, some don't have an earliest villain date at all (so they would not appear on the graph on the report view)
Is there a way to add a slicer/button to show 1month/6 months/1 year before and after their Earliest villain date?
(I hope that makes sense, please let me know how I can clarify)
Hi,
Share data in a format that can be pasted in an MS Excel file. Based on a villain data selected, show the expected result.
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
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
@Mikey_B 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.
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com