Search our Blogs
Showing results for 
Search instead for 
Do you mean 

Easy Business Intelligence: Category Trend Analysis Application Example – Part I



By: Renato Keshet, Research Manager, Hewlett Packard Labs


How to get top market-share insights from a transaction table with minimal effort? How to provide advanced Business Intelligence to decision makers, without the need for long slicing and dicing processes? That is what Category Trend Analysis, one of the new Hewlett Packard Labs APIs featured in the Labs Area, is capable of.


In this post, we walk through the few steps needed in order to run Category Trend Analysis, with the help of a new web app ( created specifically for demonstrating the use of the API.


Basic Operation

Follow the following steps for a quick demonstration of the web app and the API.


  1. Download this file, which contains an example of an input dataset. It consists of transaction records for a hypothetical store in Canada, for the months of November 2012 and December 2012* . Each record register a sale, and provides the sale value (in column “Sales”), the province where the sale took place, and the corresponding product category.
  2. Go to the web app site (, and click on the green circle “Try it Now”. To the left, there is a list of input parameters.
  3. To the left, enter your Haven onDemand API key in the first field.
  4. Click “Choose File”, and select the input dataset that you have downloaded.
  5. Enter “Month” (without quotes) in the “Groups Column” field – this specifies the column containing the different time periods.
  6. Enter “11/2012” (again without quotes) in the “Compared Group” field – this sets the first period for comparison (November 2012).
  7. Enter “12/2012” in the “Main Group” field – which determines the “current” period, or the second period for comparison (December 2012).
  8. Enter “Sales” in the “Aggregation Column” field – this specifies the column containing the values to be aggregated (sales values in this case).
  9. Click the green “SUBMIT” circle.

*This is a subset of the table provided in the website:


After a few seconds, you should receive the following screen.



That’s it. You have just received the top sales trends/insights between 11/2012 and 12/2012 for this store. In order to display this information, the application has called the Category Trend Analysis API (using the API key and the parameters you have provided), and visually formatted the returned json output.

The top trend/insight is “Province: Quebec dropped from 28.8% to 4.0%”. What this means is that, after the Category Trend Analysis service has checked the market share changes in all possible markets for all existing players, it came out with this insight as the most significant one.


When you hover your mouse over the trends/insights, a tooltip provides additional information about them. For the above first insight, the tooltip reads as follows:




The red and green boxes to the left of the insights indicate the significance of that insight. The stronger the color, the more significant it is. Red means market share reduction, whereas green refers to market share increase.


Click on any of the trends/insights. This will expand that line to provide additional insights, which are related to the main one. For instance, after clicking on the first insight, one gets:




Notice that each of the related insights have their own info tooltip as well.

Selecting the Columns to be Analyzed


In the above example, we have not entered anything in the field “Included Columns”. As a result, the Category Trend Analysis API used all the columns in the input table (and their contents) as markets and players for analysis, with the exception of the columns you have provided in “Group Column” and “Aggregation Column”. Thus, in the above case, the columns used for analysis are “Province” and “Product Category”.


Now, type “Province” (without the quotes) in the field “Included Columns”, and click SUBMIT. The returned output are insights only involving the provinces – no reference to product category is returned.




Because only one column is used, the API returned no additional relevant insights (that is, if you click on an insight it will not expand any more).

Now, click on the green + sign to the right of the “Included Columns” field you have populated with “Province”; this provides an additional field for entering another column. Type “Product Category” in the additional field.




Click SUBMIT. The results you obtain now should be identical to the first time when no columns were provided, because in both cases the API is using all the columns (except for “Month” and “Sales”) in the analysis.
The “Included Columns” entry is useful when the input table has many columns, and one does not need all the columns for the analysis. Note that the more columns are used in the analysis, the longer the API will take to return the results. We advise to provide up to three columns if you want the results in a few seconds. Also, you should use this field(s) when there are more than one “group columns” in the table (e.g., if the table has “Months” and “Years” as separate columns) and you do not want to have the additional group column be used as analysis column. The same goes for the “aggregate column”.

Count Instead of Sum


With the “Included Columns” still populated with “Province” and “Product Category” as inputs, clear the “Aggregation

Column” field and hit SUBMIT. Now the returned trends/insight are different. This is because, when no aggregation column is provided, the Category Trend Analysis API aggregates by counting the number of records (rather than summing the values in the aggregation column). Notice that the tooltip explicitly describes that the numbers (now integers) refer to counts rather to sums.




Terms of Interest

At this point, type “Furniture” (without the quotes) in the last field, “Focus Terms”, and hit SUBMIT. The results you get now contain only trends/insights that contain the term “Furniture”.




By clicking on the green + sign, you can enter any number of terms of interest you might want, and the Category Trend Analysis API will return only insights that contain at least one of the provided terms.


Part II

So, in summary, you have learned how to use the Category Trend Analysis API for quickly obtaining business intelligence from a transaction table, by means of a web app. In part II, we describe:


  • How to map the input and output API components to the elements described here in part I,
  • How to obtain the web app code for using in your own applications,
  • How to prepare your own input table for the API.

Thank you for your attention, and don’t forget to provide your feedback below.



efroselli Level 4
| ‎06-17-2016 07:24

I notice that this demo works as described in a Chrome browser, but not in Internet Explorer. Worth mentioning.

Social Media
About the Author
† The opinions expressed above are the personal opinions of the authors, not of HPE. By using this site, you accept the Terms of Use and Rules of Participation