Search code examples
javascriptpivot-tableolapolap-cubepivottable.js

PivotTable.js OLAP not considering field having more than one value


I am trying to use the PivotTable.JS Script by Nicolas Kruchten and am facing the following problem:

Some of the fields in my data have more than one value. For E.g. in the following entry, there are more than one 'segment' and 'trend':

{'Segment': ('Lending','Marketplace'), 'Trend': ('Investments', 'Expansion'),  'Month_year': 'Oct 2016', 'Link': 'http://www.geektime.com/2016/10/02/german-credit-startup-smava-bags-34-million-series-c-investment/', 'Title': 'Smava has raised $34 million Series C investment from Runa Capital', 'Country': 'Germany'},

Now,

  1. If I pass the Segment as a Tuple ( ), the PivotTable UI just considers the last entry (Marketplace), and ignores all before it (Lending). So it counts 1 for Marketplace and 0 for Lending.
  2. If I pass the segment as a List / Array [ ], the PivotTable UI considers "Lending, Marketplace" as a separate entity all together, instead of counting it separately in both "Lending", as well as "Marketplace".
  3. If I pass the segment as a dictionary { }, the script doesn't work at all.

I cannot break and repeat the entry, with one have "Lending" and another "Marketplace" - as it will lead to a lot of duplicate counts of other fields. E.g. breaking and repeating this entry for both 'segment' and 'trend' will result in four counts for the 'country: Germany', while actually there is only one.

I am stuck at this problem, and need a solution to address it. Any help would be greatly appreciated. TIA


Solution

  • Unfortunately, this library does not support multiple values per attribute, so there is no way to do what you're looking for if you are unable to break/repeat the values.