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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Gary_in_Ohio
Regular Visitor

How to filter a dataset with start and end dates

I am looking for a solution to filtering a dataset that contains start and end dates based on a user selecting one date. 

 

Below is a example of the type of data that am working with.

Sample DataSample Data

 

Below is a sample report. 

Report.png

 

In this example, we want to answer the question "Who was working where on June 1, 2022?"

 

I want the users to pick one and only one date.  The users will want to change and rechange this date easily. So, I'd prefer it to be in a slicer.  I want to use only on the data where the start comes on or before the user selected date and the end date is on or after the user selected date.

 

If the users see something incorrect, they will go into the application and make corrections. They will rerun the report and expect see their changes immediately. So, this must work with DirectQuery data.

 

My actual dataset is much more complex.  But this example gets to the heart of the issue.

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @Gary_in_Ohio 

You can create a measure like:

filter =
IF (
    MAX ( Location[StartDate] ) <= SELECTEDVALUE ( AsOf[Date] )
        && MAX ( Location[EndDate] ) >= SELECTEDVALUE ( AsOf[Date] ),
    1,
    0
)

Then you can apply this mesaure to the table visual filter pane.

veasonfmsft_0-1668568133051.png

 

Best Regards,
Community Support Team _ Eason

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @Gary_in_Ohio 

You can create a measure like:

filter =
IF (
    MAX ( Location[StartDate] ) <= SELECTEDVALUE ( AsOf[Date] )
        && MAX ( Location[EndDate] ) >= SELECTEDVALUE ( AsOf[Date] ),
    1,
    0
)

Then you can apply this mesaure to the table visual filter pane.

veasonfmsft_0-1668568133051.png

 

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@Gary_in_Ohio ,refer

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

Power BI Dax Measure- Allocate data between Range: https://youtu.be/O653vwLTUzM
https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors