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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Syndicate_Admin
Administrator
Administrator

Calculate hours of accidents

Hello Community,

I need to calculate the hours of accidents.-

I have a table (Bd Accidents) with the Start and End Date of an accident:

Msuarez_0-1670811352695.png

On the other hand, I have my calendar table, where I have determined the working days and the hours that correspond to each day.

Msuarez_1-1670811457767.png

I would like to create a measure, which adds the number of hours ( Hours Day of the calendar table ), for the days in which each of the people was injured (Table BdAccidents).

I will appreciate your help.-

Slds,

1 ACCEPTED SOLUTION

Hi,

It can be automatically in the Query Editor using

{[StartDate]..[EndDate]}

You can then expand this new column.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

I think the approach should be to create one row for each date (between the start and end date) in Table A.  Then create a relationship (Many to One and Single) from this Date column and the Date column in the Calendar Table.  To your visual, drag any date field from the Calendar Table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Dear

Is there a function that does it automatically? or would you be proposing that it be done manually?

Hi,

It can be automatically in the Query Editor using

{[StartDate]..[EndDate]}

You can then expand this new column.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.