Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grand Totals on a TabPy calc return incorrect values #30

Closed
zakahmad opened this issue Apr 21, 2017 · 4 comments
Closed

Grand Totals on a TabPy calc return incorrect values #30

zakahmad opened this issue Apr 21, 2017 · 4 comments

Comments

@zakahmad
Copy link

Grand Totals don't work well with TabPy calcs.

(using Superstore data set) This calc SCRIPT_REAL("return [1]", ATTR([Segment])) returns 1's when displayed against the Segment dimension. The Grand Total is also 1, which is incorrect as it should be 3 in this "table viz".

Upon further digging, we find if Grand Totals are displayed and the python code attempts to make use of the Segment dimension as an input, then python will receive [None] as an input with what seems to be a second call python.

The implication is you can't easily combine Grand Totals with TabPy calcs:

  • Trying to compute the Grand Total inside python isn't possible because the dimension is passed along to python as ['Consumer', 'Corporate', 'Home Office'] in one call to TabPy and [None] in a second call. The first list isn't available to python during the second call to be able to figure out the total on the python side (during the second call).
  • Relying on Tableau to calculate Grand Totals will produce the incorrect Grand Total of the TabPy calc.
@BBeran
Copy link
Contributor

BBeran commented Apr 22, 2017

This is not an issue with TabPy per se. Table calculations in general (which SCRIPT_ calculations are) behave this way. Totals are treated as a separate partition in table calculations.

@BBeran BBeran closed this as completed Apr 22, 2017
@cmtoomey
Copy link

I think the point of this Issue was that since the data itself doesn't include "Grand Total" as an element, the new element generated by Tableau's calculation/presentation engine shouldn't impact the Python calculation by default. If Grand Totals are being displayed, there should be an Pythonic way to include/exclude their usage through some sort of argument...especially since this "feature" isn't documented anywhere.

@BBeran
Copy link
Contributor

BBeran commented Apr 27, 2017

Hi Chris,
I think you misread my comment.

"The new element generated by Tableau's calculation/presentation engine shouldn't impact the Python calculation by default."

This is already the case. Since it is treated as a separate partition, it has no impact how Python computes the rest of the table.

The issue is that grand total itself isn't correct since it is not summing the results of preceding rows in the table. Rather grand total is being treated as a separate, independent table from the rest as is the case with other table calcs.

Thanks,

Bora

@zakahmad
Copy link
Author

Correct. The Grand Total doesn't impact how Python computes the rest of the table. But, it does impact the Python calculation as a whole since one Python calc is being used for both the top table and the bottom (grand total) table. The current implementation calls for Python to compute the grand total and it's not possible (see first comment for details on why)

Ultimately, whether this is a TabPy issue or Tableau issue, it's impractical to combine Grand Totals and TabPy calcs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants