Lens users currently define their aggregations in a column-oriented way. Users should be able to select any of their bucketed columns to be transposed for display purposes- this can be used to make the display more dense. This will be most clear with some examples.
Here is a relatively small table with 2 buckets and 2 metrics. Because there are 2 buckets, the user can choose the following transpose options:
- No transposing
- Transpose the first column (date)
- Transpose the second column (filters)
- Transpose both first and second columns
No transposing
The original data:
| Date |
Filters |
Count |
Sum |
| 3/24/20 |
A |
20 |
102 |
| 3/24/20 |
B |
2 |
23 |
| 3/25/20 |
A |
3 |
50 |
| 3/25/20 |
B |
6 |
81 |
| 3/26/20 |
A |
7 |
97 |
| 3/26/20 |
B |
8 |
12 |
Transpose the first column
| Filters |
3/24/20 - Count |
3/24/20 - Sum |
3/25/20 - Count |
3/25/20 - Sum |
3/26/20 - Count |
3/26/20 - Sum |
| A |
20 |
102 |
3 |
50 |
7 |
97 |
| B |
2 |
23 |
6 |
81 |
8 |
12 |
Transpose the second column
| Date |
A - Count |
A - Sum |
B - Count |
B - Sum |
| 3/24/20 |
20 |
102 |
2 |
23 |
| 3/25/20 |
3 |
50 |
6 |
81 |
| 3/26/20 |
7 |
97 |
8 |
12 |
Transpose first and second columns
|
3/24/20 - A |
3/24/20 - B |
3/25/20 - A |
3/25/20 - B |
3/26/20 - A |
3/26/20 - B |
| Count |
20 |
2 |
3 |
6 |
7 |
8 |
| Sum |
102 |
23 |
50 |
81 |
97 |
12 |
Implementation note
I propose that we implement this in visualization options for the table visualization, not as a feature of the Lens datasource or Lens editor. The main reason is that we don't need this for other visualizations, since the visual encoding would be the same.
One requirement that we need to keep is the behavior of applying a filter based on a table cell. The semantics of this should be the same, even though the table cells will be presented in a new order.
Also, as you can see in the example above, not every transposed table is as dense as others: it's possible that we can recommend the "densest" display of the table by applying some heuristics, such as "suggest that users transpose the column with the lowest expected cardinality"- this will usually not be the date histogram column, but might be the Terms aggregation.
Lens users currently define their aggregations in a column-oriented way. Users should be able to select any of their bucketed columns to be transposed for display purposes- this can be used to make the display more dense. This will be most clear with some examples.
Here is a relatively small table with 2 buckets and 2 metrics. Because there are 2 buckets, the user can choose the following transpose options:
No transposing
The original data:
Transpose the first column
Transpose the second column
Transpose first and second columns
Implementation note
I propose that we implement this in visualization options for the table visualization, not as a feature of the Lens datasource or Lens editor. The main reason is that we don't need this for other visualizations, since the visual encoding would be the same.
One requirement that we need to keep is the behavior of applying a filter based on a table cell. The semantics of this should be the same, even though the table cells will be presented in a new order.
Also, as you can see in the example above, not every transposed table is as dense as others: it's possible that we can recommend the "densest" display of the table by applying some heuristics, such as "suggest that users transpose the column with the lowest expected cardinality"- this will usually not be the date histogram column, but might be the Terms aggregation.