Hi all,
How can I calculate the hours between two start / end times? The below formula does not calculate the hours correcly
Engage Hours per day = ([Start]-[End])
Solved! Go to Solution.
Hi @HenryJS ,
You could use Time.Hour() in query editor.
if [Start]>[End] then
24-Time.Hour([Start])+Time.Hour([End])
else Time.Hour([End])-Time.Hour([Start])
Here is the result.
Hi @HenryJS ,
Does that make sense? If so kindly mark my answer as a solution to close the case. Thanks in advance.
Hi @HenryJS ,
Does that make sense? If so kindly mark my answer as a solution to close the case. Thanks in advance.
Hi @HenryJS ,
You could use Time.Hour() in query editor.
if [Start]>[End] then
24-Time.Hour([Start])+Time.Hour([End])
else Time.Hour([End])-Time.Hour([Start])
Here is the result.
@HenryJS try this expression
Column = DATEDIFF ( [Column1], [Column2], HOUR)
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@HenryJS , The formula of @parry2k will give the whole number. Not time.
You can do like
time([Date diff],0,0)
or
Proud to be a Super User!
@HenryJS , That is what your initial formula was doing ? was it a measure or column?
Proud to be a Super User!
@amitchandak @parry2k I have two columns 'Start' and 'End' both 'Time' data type.
I need a new column which calculates the hours difference between the start and end times.
Is this possible?
@HenryJS we already gave you a solution, why you are asking the same question. Can you add a new column based on the expression I posted.
Your existing column has a time format because your original calculation was [Start] - [End] which returned time.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@HenryJS you should keep the type of this new column to be a whole number, not time and I guess that is the issue. And as a best practice, always use table name with the columns in the DAX expression, not just column name and for measures never use the table name.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.
User | Count |
---|---|
444 | |
160 | |
113 | |
53 | |
52 |
User | Count |
---|---|
458 | |
142 | |
130 | |
78 | |
71 |