Forum Discussion
GeekAlfPro
3 years agoHelper V
Time comparison duration/difference
Hi, I have a table with columns of hours i have a theorical hour and a real hour, and I want to have the advances and delays In Dax, how can I get the differences lower than 0? i tried this co...
- 3 years ago
Hi,
i finally manage to get the result i want.
i set 2 more columns, based on the decimal result.
if it's <0 it's an advance
if it's >0 it's delayed
the final code is :
Colonne Ecarts = IF( HOUR(Journal[Heure théo])>= 21 && HOUR(Journal[Heure théo])<= 23 && HOUR(Journal[Heure Départ Réelle])>=0 && HOUR(Journal[Heure Départ Réelle])<=3, (Journal[Heure Départ Réelle]+1-Journal[Heure théo]), IF(HOUR(Journal[Heure Départ Réelle])<=23 && HOUR(Journal[Heure Départ Réelle])>=21 && HOUR(Journal[Heure théo])>=0 && HOUR(Journal[Heure théo])<=3, (Journal[Heure Départ Réelle]-1-Journal[Heure théo]), (Journal[Heure Départ Réelle]-Journal[Heure théo]) ))
Greg_Deckler
3 years agoCommunity Champion
GeekAlfPro Just subtract them and then multiply by 24*60*60
- GeekAlfPro3 years agoHelper V
Hello Greg_Deckler
Thanks for your proposal, but when i test, if the difference is negative, i have no data once i formated the column in hour but maybe as it's an hour format, it can't be negative...
- Greg_Deckler3 years agoCommunity Champion
GeekAlfPro Right, I would use a custom format string instead.