Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spotfire calculated column based on filter

I want to create a calculated column that is equal to the percent of the total of the previous column, but only for the rows that are selected.

For example, the two columns below show rows where I've filtered for only the rows of interest. The sum is accurate, but I want the percent of the total to be only out of sum of the currently selected rows rather than the absolute total (which is how it's currently being calculated). I want the percent of the total to dynamically change depending on what is filtered in the data table. Is this possible?

Image of my 2 columns:

enter image description here

I know spotfire somehow calculates this becuase when I insert a bar graph using % of Total(SumofComponents) the ratio is only out of the current total.

Image of my bar chart: enter image description here

like image 215
avgara Avatar asked Oct 18 '22 07:10

avgara


1 Answers

much like in programming, Spotfire has a rough concept of scope. and unfortunately, calculated columns are above filters in terms of scope; they have no concept of what is and is not filtered.

visualizations themselves, however, do*!

what you can do in this case is to put your expression on the Y axis (it looks like you've done this), and it will respect your selected filters*.

*caveats: there are a few ways that filtering can be negated on a given visualization:

  1. Properties>>Appearance>>Show shadows indicating the unfiltered data. this option shows a grey bar that represents the data hidden by whatever filter selection was made

  2. Properties>>Data>>Limit data using filterings. these options allow the viz to use separate filtering sets ("Filter Schemes" as they're called in Spotfire) or none at all (to ignore filters completely)

  3. Properties>>Subsets. by default there are three subsets: "All Data" which ignores filters, "Not in current filtering" which inverts the filter selection (e.g., if you filter a boolean column to show only TRUE, this chart would show only FALSE), and "Current filtering" which is the default behavior. you can check the online help for additional subsets that you can add.

like image 163
niko Avatar answered Oct 27 '22 10:10

niko