Why calculations for my Python/R/… SCRIPT_x field are per row?

Question Advanced Analytics Team hears somewhat regular is exactly what the title for the post says:

I created a calculated field and see the calls for TabPy/Rserve/MatLab/Einstein/etc. are made for each row. Why is that and what can I do for the field to be calculated once for the whole column?

Short answer is that behavior is how table calculation is computed – Tableau is evaluating each different value due to the settings. To change the behavior set the dimension as Specific Dimensions:

With Specific Dimensions data will be sent for calculation in one call.

For technical details read Tableau documentation on how to transform values with table calculations – https://help.tableau.com/current/pro/desktop/en-us/calculations_tablecalculations.htm#specific-dimensions.

Also consider watching these video recordings from Tableau Conference which provide some deeper dive into the topic and beyond:

  • Data science applications with TabPy/R:
  • Even More Data Science Applications in Tableau: