techg Posted February 15 Share Posted February 15 Hi, Is it possible to calculate average after the Grand Totals in CrossTab of Spotfire Analysis Link to comment Share on other sites More sharing options...
Informatics Consultant Posted February 16 Share Posted February 16 Hi Techg, Grand totals are displayed as the last row/column of your cross table. If you want to calculate an average after these totals you could try using an ironPython script. That is an example you could try and modify : from Spotfire.Dxp.Data import RowSelection from Spotfire.Dxp.Data import DataPropertyClass # Get the active cross table crossTable = Document.ActivePageReference.Visuals[0] # Get the data table associated with the cross table dataTable = crossTable.As[DataPropertyClass]().Data # Create a new row for the average calculation newRow = dataTable.NewRow() # Iterate through the columns of the cross table for column in crossTable.Columns: # If the column is not a grand total column if not column.IsGrandTotal: # Calculate the average for the column average = dataTable.Columns[column].RowValues.Average() # Add the average value to the new row newRow[column] = average # Add the new row to the table dataTable.AddRow(newRow) # Refresh the cross table crossTable.As[DataPropertyClass]().Data = dataTable Let us know, Best regards Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now