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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Adam1V
Frequent Visitor

Calculating Values between two columns

Hi All,

Im very new to Power BI so may need some help explained in simple terms.

 

Within my data source I have  <1000 rows of timesheet entries. For the most part, these are split into two columns, ‘Start Date Time” and “Finish Date Time”.

Im looking to sum these up and display the accumulated hours within the dashboard and wondered whats the best way to go about this.

 

I was thinking of creating a custom column in the power query editor to derive the time spent for each timesheet entry. Does this sound like a reasonable approach?

 

Thanks in advance.

Capture.JPG

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Adam1V , 

I am not  clear about your requirement, if you want to calculate datediff between start time and end time, you could try to use below M code to see whetehr it work ot not

Duration.Hours(Duration.From([End time]-[Start time])))

 In  addition, if possible could you please inform me more detailed information(such as your expected output and your sample data)? Then I will help you more correctly.

Please do mask sensitive data before uploading.

Thanks for your understanding and support.
Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
dax
Community Support
Community Support

Hi @Adam1V , 

I am not  clear about your requirement, if you want to calculate datediff between start time and end time, you could try to use below M code to see whetehr it work ot not

Duration.Hours(Duration.From([End time]-[Start time])))

 In  addition, if possible could you please inform me more detailed information(such as your expected output and your sample data)? Then I will help you more correctly.

Please do mask sensitive data before uploading.

Thanks for your understanding and support.
Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

Refer to my blog on a similar line, how to sum up data between two dates:https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Proud to be a Datanaut Connect on Linkedin

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Watsky
Solution Sage
Solution Sage

You could use DATEDIFF in a Calculated Column.

 

If you want the number to be positive:

 

Hours Difference = DATEDIFF([StartTime], [EndTime], HOUR)

 

 

If you want the number to be negative:

 

Hours Difference = DATEDIFF([EndTime], [StartTime], HOUR)

 


Did my answer(s) help you? Give it a kudos by clicking the Thumbs Up!
Did my post answer your question(s)? Mark my post as a solution. This will help others find the solution.

Proud to be a Super User!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors