Forum Discussion
GeekAlfPro
4 years agoHelper V
TIME COMPARISON
Hi, i want to calculate the difference between 2 hours (Theorical and real). The trouble is that i have not the day, so i try to test if the hour is after 00:00, but i don't manage to solve my f...
- 4 years ago
Wasn't able to find a solution using Power Query, but using DAX, I came up with this:
Ecarts = IF( [Heure reelle] - [Heure Theorique] > 0, [Heure reelle] - [Heure Theorique], TIME(24,0,0) - [Heure Theorique] + [Heure reelle] )Heure TheoriqueHeure reelleEcarts
23:57:20 00:07:20 23:50:00 00:01:10 23:59:10 23:58:00 22:11:05 22:11:35 00:00:30 If you really need to do this in PQ, perhaps you can try some similar logic.
Hope this helps.
Regards,
rsbin
4 years agoCommunity Champion
Wasn't able to find a solution using Power Query, but using DAX, I came up with this:
Ecarts = IF( [Heure reelle] - [Heure Theorique] > 0,
[Heure reelle] - [Heure Theorique],
TIME(24,0,0) - [Heure Theorique] + [Heure reelle] )
Heure TheoriqueHeure reelleEcarts
| 23:57:20 | 00:07:20 | 23:50:00 |
| 00:01:10 | 23:59:10 | 23:58:00 |
| 22:11:05 | 22:11:35 | 00:00:30 |
If you really need to do this in PQ, perhaps you can try some similar logic.
Hope this helps.
Regards,
GeekAlfPro
4 years agoHelper V
- rsbin4 years agoCommunity Champion
I will be on vacation next week. If you don't have any success, probably best to repost your question in a new thread, so you increase the chance of someone else helping you out.