Jump to content

Dynamic Average Line


J Gre

Recommended Posts

I'm trying to use to show the average production between wells on a line chart. I tried using 'Avg([Production]) over ([x])' but I get an error saying the expression is not valid. I'd like to be able to use a filter to show only some of the wells and the average line change automatically. Build version of Spotfire is 10.10.3.3 if that helps.

My data table:

 

 

 

Well

Date

Production

 

 

 

 

A

Jan 1

100

 

 

A

Jan 2

115

 

 

A

Jan 3

110

 

 

A

Jan 4

112

 

 

B

Jan 1

153

 

 

B

Jan 2

145

 

 

B

Jan 3

150

 

 

B

Jan 4

149

 

 

C

Jan 1

123

 

 

C

Jan 2

135

 

 

C

Jan 3

130

 

 

C

Jan 4

129

Link to comment
Share on other sites

Okay, I see... The problem here is that you use the "color by" option to draw lines for each well. And this will mess up  your plot when you additionally use Avg([Production])  on the y-axis. Because this would be split as well...

 

One workaround would be to pivot your data to get a tidy dataset. Then each well has it's production data in a single column. You can do this with a transformation on your original data table. Then build a new line chart/scatterplot and put well A,B,C on the Y axis and additinolly some expression to get the average. Something like Sum([A],,[,C]) /  Count([A],,[,C])

 

But this makes filtering very hard because you would need to adjust the expression on the axis.

 

You could also work with a data function that takes your filtered original data tables as input and that returns this filtered table as a new data table. A calculated column in this table would  be dynamic in the sense that it reacts to your filtering in the source table...

 

I really can't come to a simple satisfying solution at the moment. Sorry. Let's see if other members can help.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...