Jump to content

Spotfire calculate column base on another column


Nguyen Ngo

Recommended Posts

Hi All,

I'm new to Spotfire and I'm tryingto create a calculated column to compare the revenue between 2 years.

The table look like this:

 

 

 

ticket

fiscal_year

revenue

 

 

 

 

ABC

2018

400

 

 

ABC

2017

200

 

 

XYZ

2018

600

 

 

XYZ

2017

300

 

 

 

I would like to Subtract the revenue from the lastest year to the older one

After that the result should be like this:

 

 

 

ticket

fiscal_year

revenue

result

 

 

 

 

ABC

2018

400

200

 

 

ABC

2017

200

200

 

 

XYZ

2018

600

300

 

 

XYZ

2017

300

300

Link to comment
Share on other sites

Hello,

I created a calculated column [test] with the following expression:

Last([revenue]) OVER ([ticket])After that, I created another calculated column [final] with the following expression that achieves the use case:

If([fiscal_year]!=2017,[revenue] - [test],[revenue])Please refer to the attached analysis file.

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...