title: Using SCRIPT_REAL in Data Source Tab in Tableau
body: <p>I want to create a calculated field in my data source table (in Data Source tab of my workbook). However, Tableau is complaining that the field contains an aggregate calculation data and so it depends on the visualization's level of detail. Here is my script (using TabPy):</p>
  
  <pre><code>SCRIPT_REAL("import numpy as np 
  return (2*np.array(_arg1)).tolist()",
  SUM([Wind Speed]))
  </code></pre>
  
  <p>In this case, all the rows in this calculated field are shown as <em>null</em>.</p>
  
  <p>However, when I replace the SCRIPT_REAL with the following, it works:</p>
  
  <pre><code>2*SUM([Wind Speed])
  </code></pre>
  
  <p>Yet, in both cases, I'm using SUM [an aggregate function], so why does it work in this case but not when I'm using SCRIPT_REAL?</p>
  
  <p>All I want to do is use SCRIPT_REAL to calculate values for a new field (row-wise) and add it to my data table. What am I missing?</p>