Multidimensional analysis tables, also known as pivot tables or cross tables, refer to tables where one or more dimensions can be placed in **row dimensions** and **column dimensions**, displaying the **interrelationships between dimensions**. Users can easily analyze various scenario indicators and comparisons at a glance, aiming to assist business analysis in driving decision-making.
This might sound a bit abstract, and some readers may wonder: what does a table with multiple row dimensions + multiple column dimensions look like? Here's an example 🌰:
A marketing colleague every day needs to track the price of a certain robotic vacuum cleaner in various online stores. Let's analyze the scenario he faces: \r
"Each online store", we can summarize as the channeldimension (Dimension). According to his daily work, there is the following channel tree:
According to the different levels of the channel dimension, it is divided into: Channel | Platform | Store three Dimension Levels. Taking the "Platform" dimension level as an example, there are three values: Taobao, JD, Douyin, which we call Dimension Members (Dimension Value)
With TypeScript we can easily write type definitions for channels, as well as channel trees:
What specific data is this marketing colleague analyzing - Price. It may be divided into original price, post-coupon price, etc. These specific data are referred to as Indicators. Combining the aforementioned channel tree and price tree, we can obtain such a multidimensional table. \r
Data Concepts
Congratulations on reaching this point, you have already mastered the concept of multidimensional tables!
We further abstract the above multidimensional table and can conclude that displaying a multidimensional table requires the following data: \r
Row header tree (rowTree): A tree structure representing the hierarchical relationship of row dimensions in the header. That is, the timeTree in the example above.
Column Tree (columnTree): A tree structure representing the hierarchical relationship of column dimensions in the header. That is, the channelTree in the example above.
Generally speaking, for convenience of display, the indicator will be a leaf node of the columnTree \r
Corner Header (cornHeader): The cell located at the intersection of the row header and the list header, used to display metric titles and other auxiliary information \r
Specific data (records): That is, the specific data under various dimensions and various indicators will be displayed in the data cells (we call this area the body) \r
Objective
Implement a high-performance multidimensional analysis table with capabilities for data transformation, statistics, sorting, drilling, and visualization
Capability
The specific capabilities are outlined as follows: basic capabilities (aligned with the functionality of ListTable), as well as features unique to PivotTable.