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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MattScruggs
Frequent Visitor

Item falling between 2 dates filter by calendar date heiarchy

I have a data set with a few thousand line items. In this, there are 2 columns, a start date, and an end date. I am looking for a way to determine if an item was standing during a certain date. This is easy to do with a simple if statement, but the problem Im having is that I want to be able to filter it at the visual level by any date, selected by the user.  I have [ActualBuildDate] and [ActualDismantleDate] Where [ActualBuildDate] will aways have a date, and [ActualDismantleDate] will alway be after [ActualBuildDate] or blank (Still standing).  If I select January 2020, I want to see every item that was standing during January 2020. I have a Calender table set up using this code  Date Filter = DATESBETWEEN( 'Date'[Date], MIN('1_Overview'[ActualBuildDate]), IF(MAX('1_Overview'[ActualDismantleDate]) > MAX('1_Overview'[ActualBuildDate]), MAX('1_Overview'[ActualDismantleDate]), MAX('1_Overview'[ActualBuildDate]) )) I have set a filter with a date heiarchy using this. but filtering by the dates on it do not return the proper items. 

3 REPLIES 3
MattScruggs
Frequent Visitor

Build DateDemo Date

1/22/2020 
1/23/2020 
1/24/20202/20/2020
1/25/20202/21/2020
1/26/20202/22/2020
1/27/20202/23/2020
1/28/20202/24/2020
1/29/20202/25/2020

 

My dates look like this. 

This is the formula for my Calender table

 

Calendar = CALENDAR(MIN('1_Overview'[ActualBuildDate]),
IF(
MAX('1_Overview'[ActualBuildDate]) > MAX('1_Overview'[ActualDismantleDate]),
MAX('1_Overview'[ActualBuildDate]),
MAX('1_Overview'[ActualDismantleDate])
)
)
Anonymous
Not applicable

@MattScruggs 

Maybe provide a short sample data.

 

Regards
Paul

amitchandak
Super User
Super User

@MattScruggs , not very clear. If you want to same date range to be filtered on both dates. You can join them to the same date table. Active/inactive joins will be created. And you can use join on choice using use relation.

 

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

https://www.youtube.com/watch?v=e6Y-l_JtCq4

 

If case you need different date ranges then you can have a date range on these two dates or you can create two date tables. One joins with each date.

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.