Forum Discussion
Time not shown properly
Do you have any ideas how can I adjust this code
OverTimee Converted =
Hi Anonymous
I suggest to use measure rather than calculated column to get the result. Since you want to calculate the average delay, get the average delay in seconds first, then change the format. Here is the PBIX file.
Average Delay = VAR averageDelay = ROUNDUP ( AVERAGE ( Sheet1[delay] ), 0 ) VAR Hours = INT ( averageDelay / 3600 ) VAR Minutes = INT ( ( averageDelay - Hours * 3600 ) / 60 ) VAR Seconds = averageDelay - Hours * 3600 - Minutes * 60 RETURN Hours * 100 + MinutesKindly let me know if this helps.
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.
7 Replies
- AnonymousNot applicable
- amitchandakSuper User
Anonymous ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
refer for Duration
https://radacad.com/calculate-duration-in-days-hours-minutes-and-seconds-dynamically-in-power-bi-using-dax
https://social.technet.microsoft.com/wiki/contents/articles/33644.powerbi-aggregating-durationtime-in-dax.aspx
https://www.pbiusergroup.com/communities/community-home/digestviewer/viewthread?GroupId=547&MessageKey=814a2cb4-3cca-4cd1-a620-c467adeaaaf6&CommunityKey=b35c8468-2fd8-4e1a-8429-322c39fe7110&tab=digestviewer
https://community.powerbi.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/m-p/793639#M389 - AnonymousNot applicable
amitchandak Hi buddy,
I am sending the file, please note that the source of the pbix is the following excel and you need to change it in the power query settings(just change the source). Once u open the pbix you will see how the total average is displayed. In this case, it shows 00:84 minutes, when it should be over an hour.
You will find the file here:
https://easyupload.io/m/regwqm- amitchandakSuper User
Anonymous , I added few measures in the file attached after signature; check if those can help
- AnonymousNot applicable
amitchandak It still does not make sense, as you can see the average time is still not displayed correctly.
- AnonymousNot applicable
My purpose is to get the time value that would actually round up to the next hour at 60 minutes properly.
- v-jingzhangCommunity Support
Hi Anonymous
I suggest to use measure rather than calculated column to get the result. Since you want to calculate the average delay, get the average delay in seconds first, then change the format. Here is the PBIX file.
Average Delay = VAR averageDelay = ROUNDUP ( AVERAGE ( Sheet1[delay] ), 0 ) VAR Hours = INT ( averageDelay / 3600 ) VAR Minutes = INT ( ( averageDelay - Hours * 3600 ) / 60 ) VAR Seconds = averageDelay - Hours * 3600 - Minutes * 60 RETURN Hours * 100 + MinutesKindly let me know if this helps.
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.