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
oskarcph
Frequent Visitor

Calculate multiple occurrence over a period within multiple time ranges

 

Measure = 
var _sdate = MAX(TableA[Shift_start_date])
var _edate = MAX(TableA[Shift_end_date])
var _count = 
 COUNTROWS(
        FILTER('TableB'[DateTime]>=_sdate && 'TableB'[Datetime]<=_edate))

return
    IF(ISBLANK(_count),0,_count)

 

Hi Guys

I hope you can help me, I am trying to calcucate number of occurrences on multiple days. 
The above formula is generating the right output if I put it into a table for a daily view but if I wants to calcucate the number of occurrences in a week then it also shows the last output (Which is due to the MAX()), so can you help?




4 REPLIES 4
oskarcph
Frequent Visitor

Anyone? 🙂 

hi @oskarcph 

 

when you say "calcucate the number of occurrences in a week ", could you make a screenshot about how the measure will be showcased? what context do you have for the measure?

 

p.s. please consider @someone, to continue a discussion.

FreemanZ
Super User
Super User

hi @oskarcph 

when you say "calcucate the number of occurrences in a week ", could you make a screenshot about how the measure will be showcased?

Hi Freeman, sorry for the late reply 

oskarcph_0-1675851466776.png

oskarcph_1-1675851511468.png

So, I need to see if a flight leaves during an employee's shift, I made a column with the date and time of the flight's departure to link up with the employees shift which consist of two columns (See picture), a shift can example start at 22:00 monday and end at 06:00 on the next day

 

oskarcph_2-1675851667043.png

 

 

 

 

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.