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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
DavidAtkins
Frequent Visitor

Help with measure - count incidents between given dates

Hi

 

I need some help with a measure please! I have two tables as below. Table 1 shows a list of contracts that can renew leading to multiple rows for the same contract but with start/end dates to differentiate them. Table 2 has a list of incidents that have occurred on those contracts by date. How can I create a measure to show the incidents by contract linked to the incident date to give the required results in the bottom example? At the moment the two tables are only connected by contract number (I'm wondering if they need to be linked on the dates too?).

 

Thanks in advance for any help.

 

Table 1   Table 2 
Contract NumberContract StartContract End Contract NumberIncident Date
101/01/202131/12/2021 113/01/2021
101/01/202231/12/2022 115/05/2021
201/01/202331/12/2023 120/05/2022
301/07/202130/09/2021 315/11/2021
301/10/202131/12/2021   
301/01/202231/03/2022   
      
      
Required Result     
Contract NumberContract StartContract EndIncidents  
101/01/202131/12/20212  
101/01/202231/12/20221  
201/01/202331/12/20230  
301/07/202130/09/20210  
301/10/202131/12/20211  
301/01/202231/03/20220  
1 ACCEPTED SOLUTION
Selva-Salimi
Solution Sage
Solution Sage

@DavidAtkins 

 

you just need to write a measure as follows:

 

measure incident_count := calculate (count(incidentdate) , filter (table 2 , incidentdate >= selectedvalue(contractstart) && incidentdate<= selectedvalue(contractend))

 

If this post helps, then I would appreciate a thumbs up 👍 and mark it as the solution to help the other members find it more quickly. 

View solution in original post

2 REPLIES 2
Selva-Salimi
Solution Sage
Solution Sage

@DavidAtkins 

 

you just need to write a measure as follows:

 

measure incident_count := calculate (count(incidentdate) , filter (table 2 , incidentdate >= selectedvalue(contractstart) && incidentdate<= selectedvalue(contractend))

 

If this post helps, then I would appreciate a thumbs up 👍 and mark it as the solution to help the other members find it more quickly. 

Fantastic, thank you so much

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.