Skip to content
Snippets Groups Projects
Unverified Commit d81046a6 authored by Kamil Mielnik's avatar Kamil Mielnik Committed by GitHub
Browse files

Repro #26919 - Aggregating with Custom Column first doesn't show sub-totals in pivot table (#45479)

parent 5707fcdc
No related branches found
No related tags found
No related merge requests found
......@@ -1397,6 +1397,81 @@ describe("scenarios > visualizations > pivot tables", { tags: "@slow" }, () => {
.and("contain", "Sum of Total")
.and("contain", "Grand totals");
});
it("displays total values for collapsed rows (metabase#26919)", () => {
const categoryField = [
"field",
PRODUCTS.CATEGORY,
{ "base-type": "type/Text" },
];
createQuestion(
{
display: "pivot",
query: {
"source-table": PRODUCTS_ID,
expressions: {
test: [
"case",
[[["is-null", categoryField], categoryField]],
{ default: categoryField },
],
},
aggregation: [["count"]],
breakout: [
["expression", "test", { "base-type": "type/Text" }],
[
"field",
PRODUCTS.RATING,
{
"base-type": "type/Float",
binning: {
strategy: "default",
},
},
],
],
},
visualization_settings: {
"pivot_table.column_split": {
rows: [
["expression", "test"],
["field", PRODUCTS.RATING],
],
columns: [],
values: [["aggregation", 0]],
},
"pivot_table.collapsed_rows": {
value: ['["Doohickey"]', '["Gadget"]', '["Gizmo"]', '["Widget"]'],
rows: [
["expression", "test"],
[
"field",
PRODUCTS.RATING,
{
"base-type": "type/Float",
binning: {
strategy: "num-bins",
"min-value": 0,
"max-value": 5.25,
"num-bins": 8,
"bin-width": 0.75,
},
},
],
],
},
},
},
{ visitQuestion: true },
);
getPivotTableBodyCell(0).should("have.text", "42");
getPivotTableBodyCell(1).should("have.text", "53");
getPivotTableBodyCell(2).should("have.text", "51");
getPivotTableBodyCell(3).should("have.text", "54");
getPivotTableBodyCell(4).should("have.text", "200");
});
});
const testQuery = {
......@@ -1496,3 +1571,10 @@ function sortColumnResults(column, direction) {
expect(decodedQuery).to.include(direction);
});
}
function getPivotTableBodyCell(index) {
return cy
.findByLabelText("pivot-table-body-grid")
.findAllByTestId("pivot-table-cell")
.eq(index);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment