Forum Discussion
Average lead time
Hello all,
I'm trying to figure out how to show my average lead time, changeable with whatever the user selects as filter (year, type of ticket, drill down deeper into a year for months etc.) as a card visual, or any other. With the result I want to have being something like: 2017 selected. Lead time displayed: 104:44 (or just 104 hours).
Right now I have the following, where every timestamp is the lead time for one ticket/record:
In the database this is registered as seconds, so I converted it to a HH:MM:SS format with the column set as time. I tried
Hi Anonymous ,
Using your oringinal data "Seconds" for calculation would be better.
Create 2 measures as below:
average = AVERAGEX(ALLSELECTED('Table'),'Table'[Seconds])format = var _hour=INT('Table'[average]/3600) var _min=INT(DIVIDE('Table'[average]-_hour*3600,60)) var _sec=INT('Table'[average]-_hour*3600-_min*60) Return _hour&":"&_min&":"&_secAnd you would see:
For my related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
5 Replies
- v-kelly-msftCommunity Support
Hi Anonymous ,
Using your oringinal data "Seconds" for calculation would be better.
Create 2 measures as below:
average = AVERAGEX(ALLSELECTED('Table'),'Table'[Seconds])format = var _hour=INT('Table'[average]/3600) var _min=INT(DIVIDE('Table'[average]-_hour*3600,60)) var _sec=INT('Table'[average]-_hour*3600-_min*60) Return _hour&":"&_min&":"&_secAnd you would see:
For my related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
- AnonymousNot applicable
Wow! Thanks a lot! I can't thank you enough, this saved such a headache. Thank you for the expert help.
- v-kelly-msftCommunity Support
Hi Anonymous,
It's my pleasure.🙂
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
- amitchandakSuper User
Anonymous , You need to convert to seconds average up and convert back
these blog have give that in details
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- AnonymousNot applicable
Neither of these solutions seem to work. The radacad one, for example, where I directly copied the code, doesn't work for me. I have a similar date slider but this changes nothing, since the values remain at 0 hours, 0 minutes and 0 seconds. I'm not sure what I'm doing wrong here.