Forum Discussion
Adam1V
6 years agoFrequent 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 column...
- 6 years ago
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 ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Watsky
6 years agoSolution 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)