Tip of the Week

Using Node Navigation Methods in Calculated Columns

People always ask us if there is a way to show changes in values from within the same column over different intervals, like weeks or months. For example, what was the sales this week compared to the sales last week, how much did a patient weight this visit compared to last visit, or what was the change in stock price from this quarter compared to last quarter?  You can do this using a custom expression, but then the values are not available to use elsewhere. If you wish to view them elsewhere (like in a table plot), you will need to use a calculated column.  

Let’s assume we have the following data loaded that displays sales data per week:

.

If we plot this on a Line Chart , as shown below, we can see the trend of sales per week.


 
We may want to be more specific and show the change in sales from one week to another. For this, we can use the previous Node Navigation Method in a calculated column expression as shown below:



The result will be a new column called Weekly Change. We can then plot the Weekly Change on a Bar chart as shown below.

 

 
What if your data contains another category you want to group by? Say you have multiple salespeople and you want to look at weekly change per salesperson?


For this you can use the same expression as before , but also use the Intersect method to say to group by the Salesperson column.

Once this is done, the newly created column contains the weekly change per salesperson.


 

Notice the Weekly Change value for the first row is empty, since there was no previous value to compare it to. You can add methods into the expression to remove the null value with a zero if desired.

You can also plot this on a Bar Chart using the Trellis feature to Trellis by Salesperson to see their individual weekly change.


 
Keep in mind the differences between using calculated columns and custom expressions. If you filter your data, the custom expression will be recalculated, but the calculated column will not be. 

If you want more information on the Intersect method, the previous method (or any other Node Navigation) methods, please take our SP 141 Computational Analytics course using one of our three delivery options: onsite, regional, or blended. This course will teach you all the core concepts required to understand the Spotfire Expression Language  in either a calculated column or a custom expression.

Comments

 

Andre Kooy said:

Hello Kevin,

Good post, but it is difficult to tie the graphs to the correct table. Specifically, your first bar chart points to data of the table below, not the top table as I would have expected. Also, the first bar chart only relates to sales person A.

Useful tip though, as always.

Kind regards, Andre

January 4, 2010 8:38 AM
 

Kevin Hanegan said:

You are right Andre, thanks for spotting that. I have updated the first Bar Chart to show the correct data (from above it).

Thanks,

Kevin

January 4, 2010 2:31 PM
 

Ivneet said:

If  I have a data table like

Month  TierType

Jan        t1

Jan        t1

Feb        t2

feb        t1

Jan        t1

Jan        t2

and I want to get a tier change matrix per month.  For e.g. there were 3 t1's in jan but only 1 in feb then change in count of t1 is 1-3/3* 100. How do I do this in spotfire without hardcoding the month?

February 8, 2010 2:17 PM
 

Rainier said:

1 You are obliged to add a statistical function in the expression, or it will not work. eg you cannot state timedate-timedate Over etc.

but you have to use min(timedate-timedate) or (min(datediff(timedate1, timedate2)) (where min can be substituted by any statistical function).

I don't understand why this is necessary. Anyone?

November 11, 2010 11:38 AM
 

maidirepoker said:

Declining graphics looks like my company's graphics.

October 3, 2011 3:04 PM
 

uggkensington said:

http://www.uggkensingtons.org/

http://www.uggkensingtons.org/ugg-fox-fur-short-boots-5531-c-54.html | UGG Fox Fur Short Boots 5531

http://www.uggkensingtons.org/ugg-kensington-boots-5678-c-2.html | UGG Kensington Boots 5678

http://www.uggkensingtons.org/ugg-rainier-eskimo-boots-5189-c-85.html | UGG Rainier Eskimo Boots 5189

http://www.uggkensingtons.org/ugg-retro-cargo-boots-1895-c-3.html | UGG Retro Cargo Boots 1895

December 27, 2011 8:17 PM
 

uggskensingtonsale said:

www.uggskensingtonsale.org

www.uggskensingtonsale.orgugg-adirondack-boots-ii-c-6.html | UGG Adirondack Boots II

www.uggskensingtonsale.orgugg-adirondack-tall-boots-c-11.html | UGG Adirondack Tall Boots

www.uggskensingtonsale.orgugg-amberlee-boots-c-34.html | UGG Amberlee Boots

www.uggskensingtonsale.orgugg-annabelle-boots-c-35.html |

December 28, 2011 4:22 AM
 

uggretrocargosale said:

January 4, 2012 8:51 PM

Leave a Comment

(required) 
(optional)
(required) 
Submit

Syndication

Other Spotfire Blogs

Spotfire's interactive information visualization and analytic solutions give users a remarkable experience for quickly and easily querying data and reporting results for superior business intelligence. From portfolio management and customer retention programs to key processes such as CRM, marketing, research, bioinformatics, yield and asset management and design for manufacturing, enterprises around the world rely on Spotfire's business analytics software to improve operational performance.

©Copyright 2000-2011 TIBCO Software Inc | Privacy Policy | Terms of Use I Blog I Contact Us I Content Center