Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AndreaPRJ
Helper I
Helper I

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.

 

image.png

 

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...):
AndreaPRJ_2-1639759729923.png

Why?

Thanks in advance!

 

1 ACCEPTED SOLUTION
ebeery
Solution Sage
Solution Sage

@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...

View solution in original post

2 REPLIES 2
ebeery
Solution Sage
Solution Sage

@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...

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

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.