Rikin
Rikin

Reputation: 275

Difference between last and first in Spotfire

I have the following data set with 2 columns - Period, Score

Period  Score  
3/1/2016    2  
3/1/2017    3  
12/1/2018   3  
3/1/2016    3  
3/1/2017    3  
12/1/2018   3  
3/1/2016    2  
3/1/2017    3  
12/1/2018   4  
3/1/2016    2  
3/1/2017    3  
12/1/2018   4  
3/1/2016    2  
3/1/2017    2  

I am looking for an expression which finds out the Difference of average scores between the first and last period. In the above example,

Average Score in first period = Avg(score) in 3/1/2016 = (2+3+2+2)/4 = 2.25

Average Score in last period = Avg(score) in 12/1/2018 = (3+3+4+4)/4 = 3.5

Difference in average score change between first and last period = 3.5 - 2.25 = 1.25

Upvotes: 2

Views: 526

Answers (1)

flux
flux

Reputation: 1648

Calculated column 1: Average Score Over Period

Avg([Score]) OVER ([Period])

Calculated column 2: Difference

Max([Average Score Over Period]) - Min([Average Score Over Period])

Upvotes: 1

Related Questions