Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
There are number of date slicers/filters for Power BI that can filter on a single date column within a dataset being within a user selected date range. However, I need a slicer/filter that works the opposite way round. We have records in our dataset that have ValidFrom and ValidTo date columns and what I need to do is filter the rows based on whether or not a user selecte date is within the date range in the ValidFrom and ValidTo columns.
Non of the custom visuals available online appear to do what I want, and I looked at writing a custom visual of my own to do it, but it seems the filtering/interaction between visuals is only setup for checking if a single column in the dataset is within the user selected date range.
Is it possible to have a visual that filters on whether or not a user selected date is within the date range specified in the data rows, and if so, how do I do it?
I would try adding a measure to find whether the selected date is between your valid to/from dates (something akin to the below)
Active Record on Date =
var selDate = SELECTEDVALUE('Calendar'[Date])
var isActive = if(and(selDate>=firstdate('Table'[valid from]),selDate<=firstdate('Table'[valid to])),1,0)
return isActive
some screenshots for context:
My Data:
My Fields:
My Slicer:
My Filter:
This will filter down the records when the selected date is between the to/from dates. hope that helps
Hi @RichardBroadley,
If I understand correctly, you won't have much luck finding/using custom visuals to solve this, as they are bound by the same rules as the data model in terms of filtering, as you have discovered.
If you want to filter based on effective/end date ranges, the simplest implementation will be to create a measure that flags your record if its date range matches the selected date in a regular slicer, and then filter by that in any visuals. Note that this technique requires using 1/0 int values rather than TRUE/FALSE, as for some reason boolean measures can't be used as filter values in visuals, but numeric values can.
I believe this post should give you the concept of what you need, the answer marked as the solution covers the final state, but start reading from this post in the thread.
Hopefully this should be all you need. If not, if you can provide some sample data or workbook we can take a stab at it.
Regards,
Daniel
Proud to be a Super User!
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
7 | |
6 | |
3 | |
2 | |
2 |