Jump to content

Recommended Posts

Posted

I want to find difference between two sets of data, where I aggregate the value for row set one and row set two and find the difference between the two..

I am looking for something like this -

Posted

You can achieve this using bunch of calculated columns like below:

- Get value from previous category set for each country, store location using over function - This is for category 2

- Get value from next category set for each country, store location using over function - This is for category 1

- Then just take difference between original value and previous or next value depending oncategory set.

2. Data > Add calculated column...

Column name: prevvalue

Expression: First([Value]) OVER (Intersect([Country],[store Location],Previous([Category])))

3. Data > Add calculated column...

Column name: nextval

Expression: First([Value]) OVER (Intersect([Country],[store Location],next([Category])))

4. Data > Add calculated column...

Column name: Diff

Expression: Abs(case when [nextval] is not null then [nextval] - [Value] else [Value] - [prevvalue] end)Over function references:

https://docs.tibco.com/pub/sfire-analyst/10.8.0/doc/html/en-US/TIB_sfire-analyst_UsersGuide/ncfe/ncfe_over_in_calculated_columns.htm

https://docs.tibco.com/pub/sfire-analyst/10.8.0/doc/html/en-US/TIB_sfire-analyst_UsersGuide/ncfe/ncfe_advanced_custom_expressions.htm

https://docs.tibco.com/pub/sfire-analyst/10.8.0/doc/html/en-US/TIB_sfire-analyst_UsersGuide/ncfe/ncfe_over_in_custom_expressions.htm

 

Note: Next time please provide the sample data in file (.csv or .xls) to be imported in Spotfire rather than image format as it would be helpful for anyone trying to answer your question.

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