Forum Discussion

AndreaPRJ's avatar
AndreaPRJ
Helper I
4 years ago
Solved

Wrong difference in Hours From Two dates

Good afternoon everyone.

I'm going crazy trying to understand why Power bi shows me certain values ​​in making the difference (in hours) between

two date fields.

I have a start date and an end date and I would like to calculate the difference in hours  and then in working days (hours/8) using two calculated columns.

 

 

Where calculated columns are :

      Difference in HH

if(
IsBlank(cr35e_PRJ_BusFlow_tempifase[actualstart]) || ISBLANK(cr35e_PRJ_BusFlow_tempifase[actualend]) ||
cr35e_PRJ_BusFlow_tempifase[actualstart] > cr35e_PRJ_BusFlow_tempifase[actualend];
blank();

datediff(cr35e_PRJ_BusFlow_tempifase[actualstart];cr35e_PRJ_BusFlow_tempifase[actualend];HOUR)
)

 
And 
      Difference in Working Days = Difference in HH / 8
 
however I get completely busted values.
 
They only look correct when I have low values (but not always...):

Why?

Thanks in advance!

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    AndreaPRJ maybe dumb question, but given these are calculated columns and you're pulling them into a visual, what is the aggregation you have set on the "Difference in HH" column? (sum, average, do not summarize, etc.)

    And, relatedly, are "actualstart" and "actualend" unique?

    What I'm getting at here, is could those values you're seeing in "Difference in HH" actually be the sum of numerous records...

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    AndreaPRJ maybe dumb question, but given these are calculated columns and you're pulling them into a visual, what is the aggregation you have set on the "Difference in HH" column? (sum, average, do not summarize, etc.)

    And, relatedly, are "actualstart" and "actualend" unique?

    What I'm getting at here, is could those values you're seeing in "Difference in HH" actually be the sum of numerous records...

    • AndreaPRJ's avatar
      AndreaPRJ
      Helper I

      the question was not stupid ... it was a trivial mistake and I thank you!

      It's Friday, I need a rest 🙂 bye!