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

datediff Hours

Hello All,

 

I´m struggling on how to solve a problem using Datediff function,

I have two columns, start and end date with dd/mm/hh format.

I need to show the hours that passsed between two dates in diferent days, but my problem is, I must only  count the workday hours (9:00:00 am to 18:00:00 pm) and ( monday to friday)

 

My code just take total hours:

Servicios_Horas = DATEDIFF('Maester Estimaciones'[Fecha de Inicio Estimación],'Maester Estimaciones'[Fecha Fín Estimación],HOUR)

has anybody got an idea on how i would approach this?

 

thanks, Ricardo

1 ACCEPTED SOLUTION
RicardoAlfa
Frequent Visitor

Thanks a lot Greg!

 

Your Quick measure was helpful to show my information in a nice format.

View solution in original post

3 REPLIES 3
RicardoAlfa
Frequent Visitor

Thanks a lot Greg!

 

Your Quick measure was helpful to show my information in a nice format.

Greg_Deckler
Community Champion
Community Champion

Use my Net Work Days quick measure to figure out the number of working days. Multiple by 24 and adjust depending on your start/end times. Sample data would help. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Net Work Days Quick Measure: https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/m-p/367362



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi Greg,

 

Great solution with creating Network days function in power bi. Business days excluding holidays are accurate for my data output, but i am having trouble adjusting the code for business hours of 7:30am to 5pm. Where in the code do I adjust, and how do I adjust? Also, some date differences are under 1 hour, so would you able to code it for example '0 hours 13 minutes' as well? 

 

Thanks,

Emma

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.