code: private Number calculateDurationPercentComplete(Row row)
     {
        double result = 0;
        double targetDuration = row.getDuration("target_drtn_hr_cnt").getDuration();
        double remainingDuration = row.getDuration("remain_drtn_hr_cnt").getDuration();
  
        if (targetDuration == 0)
        {
           if (remainingDuration == 0)
           {
              if ("TK_Complete".equals(row.getString("status_code")))
              {
                 result = 100;
              }
           }
        }
        else
        {
           if (remainingDuration < targetDuration)
           {
              result = ((targetDuration - remainingDuration) * 100) / targetDuration;
           }
        }
  
        return NumberHelper.getDouble(result);
     }
docs: Calculate the duration percent complete.
  
  @param row task data
  @return percent complete