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
jtorresjasso
Regular Visitor

Measure to count if meets condition in many to many relationship

Hello. I am fairly new with PowerBI and this is my first post. I am struggling with creating a measure from a many to many relationship. I have a table that has a date series for each day that a requisition was open to use as a timeline. I have another table with timelines (ranges) of when that requstion was posted. What I am trying to do is count the requisition as posted on a prticular day if the date falls between one of the posted stints from the timeline table. I could just fill the date series for each stint, but I don't want to make my data model to complicated so I'm hoping there is an alternative.

 

Table 1 - Open Timeline

 

REQ_NUMBERFLAGSTART_TIME
238277OPEN3/23/2022 0:00
238277OPEN3/24/2022 0:00
238277OPEN3/25/2022 0:00
238277OPEN3/26/2022 0:00
238277OPEN3/27/2022 0:00
238277OPEN3/28/2022 0:00
238277OPEN3/29/2022 0:00
238277OPEN3/30/2022 0:00
238277OPEN3/31/2022 0:00
238277OPEN4/1/2022 0:00
238277OPEN4/2/2022 0:00
238277OPEN4/3/2022 0:00
238277OPEN4/4/2022 0:00
238277OPEN4/5/2022 0:00
238277OPEN4/6/2022 0:00
238277OPEN4/7/2022 0:00
238277OPEN4/8/2022 0:00
238277OPEN4/9/2022 0:00
238277OPEN4/10/2022 0:00

 

Table 2 - Post History

 

REQ_NUMSTART_DTEND_DT
2382773/24/2022 0:004/3/2022 0:00
2382775/3/2022 0:005/9/2022 0:00
2382775/26/2022 0:005/27/2022 0:00

 

Basically by my logic, this requisition should be counted as posted from 3/23 - 4/3 and not counted again until 5/3

 

I created a measure that meets the logic, but it makes me aggregate the start_dt and end_dt to a min and max which is would show it posted on days when it actually wasn't.

 

Any clues or suggestions would be helpful as far as what function to look for.

 

1 REPLY 1
lbendlin
Super User
Super User

You should do a range intersect to see where your tables match/overlap.

 

Thank you for providing sample data. What would the expected result look like?

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.