 
     IF @calcMedian = 1
     BEGIN
-        SELECT @median = (
+        SELECT @median =
+        (
              (SELECT MAX(TMIN) FROM
                   (SELECT TOP(50) PERCENT
                           CASE WHEN @durationAccuracy = 'ns'  THEN CAST(DATEDIFF(ns,  RunTimeStamp, FinishTimeStamp) AS INT)

    Author: Konstantin Taranov
    Modified date: 2017-12-23
    Version: 2.0
*/
AS
BEGIN TRY

    DECLARE @rts         DATETIME2(7);
    DECLARE @finishTime  DATETIME2(7);
    DECLARE @duration    INT;
    DECLARE @startTime  VARCHAR(27);

    DECLARE @t           TABLE (
        StartTimeStamp   DATETIME2(7)
