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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Drop down box to filter two dates

Hi everyone,

 

I am setting up a report page with multiple charts. I want to have on the left of the page two drop down boxes with start date to filter and then end date so people can choose which dates they want to filter on. So they can choose jan-2015 to feb 2016 or what ever time period  they choose that is in my data. How do i set this up? between slicer does not work because it is the bar that slides along not a drop down box and relative slicer does not work because it is not flexible with the date window you can select. I cannot find any tutorial online which I thought was strange.

 

Thanks for any help

1 ACCEPTED SOLUTION

For filtering second drop down based on first you can create a measure as below and use it as visual level filter on visual.

end_date_filter =
IF ( MAX ( _end_date[Date] ) >= SELECTEDVALUE ( _start_date[Date] ), 1, 0 )

Samarth_18_0-1628584440675.png

And sorting your dates make sure you have marked your date column type  as date from ribbon.

 

Samarth_18_1-1628584592628.png

Once you set it as date and click elipsis(three dot) of slicer you will get sort option like below. so you can use it for sorting according to your need.

Samarth_18_2-1628584663497.png

 

 

 

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thanks Samarth

 

When I do the steps above my second drop down box only lets me select the date in the first drop down box. The second drop down box filters on the first drop down box. Also the date ordering is alphabetical not cronological. How do I change that?

 

Thanks

For filtering second drop down based on first you can create a measure as below and use it as visual level filter on visual.

end_date_filter =
IF ( MAX ( _end_date[Date] ) >= SELECTEDVALUE ( _start_date[Date] ), 1, 0 )

Samarth_18_0-1628584440675.png

And sorting your dates make sure you have marked your date column type  as date from ribbon.

 

Samarth_18_1-1628584592628.png

Once you set it as date and click elipsis(three dot) of slicer you will get sort option like below. so you can use it for sorting according to your need.

Samarth_18_2-1628584663497.png

 

 

 

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Samarth_18
Community Champion
Community Champion

Hi @Anonymous 

You need to create two custom table one for start date and one for end date.

 

_start_date = CALENDAR(MIN(table[Date]),MAX(table[Date]))

 

 

 

_end_date = CALENDAR(MIN(table[Date]),MAX(table[Date]))

 

Note:- Pass your that table in above code from which you want to create a date range based on your available data.

 

Add these two table as dropdown slicer

Samarth_18_0-1628051777944.png

Now create a measure to filter your visual based on your selection as below

 

_filter_data = if(MAX(table[Date])>=SELECTEDVALUE(_start_date[Date]) && MAX(table[Date])<=SELECTEDVALUE(_end_date[Date]),1,0)

 

Create this measure for each of your visual which you want to filter based on selection and add it as visual level filter. Just make sure you are passing date that is used in specific visual.

Samarth_18_1-1628052311081.png

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

Thanks Samarth, I get an error saying DAX does not allow dates to be compared to text. Also how do I order my dates cronologically in the slicer drop down box and not alphabetically?

 

Thanks

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors