title: How can I add Lead time calculation inside Team Services and Visual Studio Team Services
body: <p>I have some questions about Visual Studio Team Services (previously Visual Studio Online).</p>
  
  <p>Basically, I want to calculate the average lead time in team services Projects and to present measurement in Team services the same way as number of active bugs in a Query report. To be able to do that I have to find all work order items that have a finish/done date, sum all days between done_date - active_date for each work order divided by all work orders With done date. But it is difficult to do make customized calculations inside team services. So what possibilites do I have. I know there is a REST Api that can be used, or maybe I can use Excel in any way or maybe there is an extension possibility in Team services that I can use.</p>
  
  <p>If I have to create a C# program that uses Rest API or may be I can use SQL Server 2016 in any way, Power Query or so, I also want to make the number available in Team services again or in Power BI to create a Dashboard where I can add this New measurement in team services again?</p>
  
  <p>I hope I explained myself enough that you could understand my problem and I would be very happy if somebody has a good guidance or examples or link to articles that explain an approach to solve my issues,</p>