Skip to Main Content
Spotfire Ideas Portal
Status Future Consideration
Product Spotfire
Categories Custom Expressions
Created by Guest
Created on Jun 4, 2016

Ability to refer to filters in any custom expression

Goal:

Currently custom expressions in calculated columns cannot refer to filtering schemes to find out whether a given row is filtered in or out. Also custom expressions in visualisations can only refer to their visualisation's filtering schema (as the expression will on be evaluated on top of that). With this enhancement developers would have the complete freedom of interacting with filtering schemes in custom expressions, including (but not limited to):

  • find out if a given row is filtered by a given filtering scheme in a custo expression
  • find the intersect of two filtering schemes in a custom expression
  • count the number of rows filtered by a given filtering scheme compared to the overall row count of table
  • perform aggregated calculations over the filtered out and filtered data set and compare the two to each other
  • perform aggregated calculations over filtered rows in two different filtering schemes and compare the two to each other

Implementation idea:

A new function which could be used in customs expression. It would accept one input (string), which would be the name of the filtering scheme. The return value would be a boolean, true if the given row is not filtered out by the given filtering scheme, and false if the row is filtered out. Ie:

  • FilteredRows("My Filtering Scheme") -> returns true or false depending on whether a row is filtered in or out
  • FilteredRows("My Filtering Scheme") and FilteredRows("An another Filtering Scheme") -> only true if a given row is displayed in both filtering schemes
  • Sum([Value]) OVER FilteredRows("My Filtering Scheme") -> perform aggregation over the group of filtered in and filtered out rows

Obviously the result of the function would need to be updated dynamically, so as soon as the filter values are changing, the custom expression which refers to the given filtering scheme would need to be re-evaluated.

 

Update:

The take this idea one step further: a second optional parameter for the new function which would be the name of the column for which the filter status we are interested in. An example:

Fruit Count Filtered rows Filtered fruits
Apple 10 true true
Apple 5 false true
Banana 10 false false
Orange 8 false false

 

The above results are with the following filter settings:

Fruit column: filtered to show "Apple" only

Count column: filtered to show "10" only

 

"Filtered rows" is a calculated column with the following expression: FilteredRows("FilteringScheme")

"Filtered fruits" is a calculated column with the following expression: FilteredRows("FilteringScheme","Fruit")

  • Attach files
  • Guest
    Reply
    |
    Jul 25, 2016

    now that i'm able to edit the post I've added the above comments into the initial post

  • Guest
    Reply
    |
    Jun 4, 2016

    related idea which could also be achieved if my idea would be implemented:

    SPF-I-59 - Update Calculated Column when filtering changes

  • Guest
    Reply
    |
    Jun 4, 2016

    the table has been truncated unfortunately. The custom expression for the second calculated column is as follows: FilteredRows("FilteringScheme","Fruit")

  • Guest
    Reply
    |
    Jun 4, 2016

    The take this idea one step further (I just can't edit my own idea): a second optional parameter for the new function which would be the name of the column for which the filter status we are interested in. An example:

    Fruit Count Filtered rows (calculated column)
    FilteredRows("FilteringScheme")
    Filtered fruits (calculated column)
    FilteredRows("FilteringScheme","Fruit")
    Apple 10 true true
    Apple 5 false true
    Banana 10 false false
    Orange 8 false false

    The above results are with the following filter settings: 

    Fruit column: filtered to show "Apple" only

    Count column: filtered to show "10" only