title: Calculate average of a row in SQL Server
body: <p>I have the below table..the percent column is of type nvarchar</p>
  
  <pre><code>Data  Percent1 Percent2 Percent3
  1     3%        4%        6%
  2     6%        8%        7%
  3     8%        6%        8%
  </code></pre>
  
  <p>I have to calculate the Avg per line so I get results like
  Data Avg</p>
  
  <pre><code>1    4.33%
  </code></pre>
  
  <p>I was trying to convert the %column into decimal so I can apply the average function </p>
  
  <pre><code>select
  Case WHEN Isnumeric([Percent1]) = 1
  THEN CONVERT(DECIMAL(18,2),Replace([Percent1],'%',''))
  ELSE 0 END AS Percent1
  from DashboardData
  </code></pre>
  
  <p>but I am just getting 0 values..I am guessing the outer function is running before the inner for some reason. Can someone please tell me how I can achieve this.</p>
  
  <p>I know the IsNumeric function will make it 0 but I tried it before that and I was getting an exception that type is not a number.</p>
  
  <p>Thanks</p>