Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

How to create a custom slicer with two options containing range of dates?

Hi, I am analyzing macroeconomic factors and for that I want to create a custom slicer (checkbox style) containing two options (Before the pandemic & After the pandemic). The goal is that if I click on before the pandemic my visuals should show the trend of before the pandemic and if I click on after the pandemic it should reflect trend following the pandemic. I would truly appreciate if anyone can help me achieve this. Thanks

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous see attached, it is fairly easy to tweak from here. As a best practice, I added a date dimension in the model and added a column to identity dates before and after pandemic and then use this for slicing the data. Also for every date calculation, it is advisable to use date dimension and use a column from it to filter data, like on year, month date etc.

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

8 REPLIES 8
parry2k
Super User
Super User

@Anonymous see attached, it is fairly easy to tweak from here. As a best practice, I added a date dimension in the model and added a column to identity dates before and after pandemic and then use this for slicing the data. Also for every date calculation, it is advisable to use date dimension and use a column from it to filter data, like on year, month date etc.

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Thank you so much. This is what I needed. Much appreciated

parry2k
Super User
Super User

@Anonymous can you explain what these tables are and what your expected output? I have no idea what you are looking for? What trend before and after? What date you have in mind for Pandeming before and after. March 15th, 2020??



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Basically these tables are for monthly unemployment claims and unemployment rate. I overlaid these two data sources with my proprietary data which I didn't share. The point is I want to filter my visual's on the basis of a slicer which should have two values, before the pandemic and after the pandemic. 

 

 

hkhan_0-1612994453404.png

In this case, the slicer contains all the year values. I want to create 2 partitions or 2 values in this slicer. So when I select before the pandemic it should show the trend before Macrh 15th and if I select after it should show the trend after Macrh 15th. Please let me know if its still unclear, I will try my best to explain. Thanks for the help. 

parry2k
Super User
Super User

@Anonymous It will be easier if you share pbix file using one drive/google drive with the expected output. Remove any sensitive information before sharing.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Link of the sample file which contains dataset 

 

In this I want to create a check box type slicer containing two options (Before and after the pandemic). Thanks

parry2k
Super User
Super User

@Anonymous I guess you will have a date that you will check before and after, correct?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Yes absolutely, I would check on the basis of date. Currently, I have a date column in each of my table. I am absolutely beginner in pbi and would appreciaet your help. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.