Business Intelligence Tools

Spotfire Expressions — Combining Values Along the Horizontal Axis

  • Have you ever wanted to create groupings along the x axis but not been sure how to do that?
  • Have you used show/hide in the Properties dialog but wanted more of a combine feature?

If you follow the blog regularly, you’ve seen plenty of postings with information about writing custom expressions, especially along the y axis.  You can also write custom expressions on the x axis, and that is precisely what we will do in order to combine data along the x axis.

This first screen shot is our starting point.  We have gas production on the y axis and a well name on the x axis.  Ideally we only want to see the top 10 wells, and we want everything else to be lumped into one bar so that the chart shows the “best” wells and everything else is lumped together.

 

In order to get the desired result, we want to write an expression on the x axis of the visualization (not the y axis).  Here is the expression shown in the dialog and cut/paste below.

If(DenseRank(Sum([GasProd]) over ([Well Name]),”desc”)<=10,[Well Name],”All Other Wells”) as [Well Name]

This is the end result.  We see 10 distinct wells and the rest are combined into one bar.

 

 

1 thought on “Spotfire Expressions — Combining Values Along the Horizontal Axis

  1. wenke Reply

    Simplest way is to mark all the bars except the top 10 and group them as a category ” all other wells” . That does the trick too. But its always good to have this expression in case we are using this in a python script, this would be indispensable. Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *