2 weeks ago
I was wondering if anyone has been able to display totals in a Table/Pivot visualization? Similar to what is possible in other BI tools?
If I have a table with a bunch of rows and one of the columns is Total Cost, I want to be able to show a Total at the end of the table which sums the total cost of the column. Would also like for the Total to be flexible and always displayed.
If possible would like to avoid calculating the Total in a SQL query, any ideas
2 weeks ago
At the moment, Databricks visualizations do not natively support dynamic total rows or grand totals like Excel or Power BI do.
You can show aggregations (SUM, AVG, etc.) in your query, but the visualization layer itself wonโt automatically display a โTotalโ row at the bottom.
If you build dashboards through notebooks or SQL queries, you can use a DataFrame summary and render via display(). Simpler way, it is still sql, use UNION ALL. You can always built a custom visual.
Databricks has this feature on the roadmap for Lakeview Table visualizations, expected to support total and subtotal rows similar to pivot tables soon, but I don't know the release date!
Tuesday
Totals are possible in pivot tables now, for both row and column groups. The option "Display total" is a bit hidden in the group properties.
Wednesday - last edited Wednesday
In a Pivot Table, "Display total" is checked for the Row, a row for Grand Total gets added, and the layout looks correct, and there are values in each column for Grand Total, but the totals are wrong -- the Grand Total values are just repeats the values from the first row of the pivot table. I tried refreshing the dataset.
I am very grateful for the existence of "Display totals" feature, but I wonder if it needs to be bugfixed or documented.
Since pivot table totals are a new feature, I comment in hopes that this helps iron out the functionality.
Thursday
@SFDataEng For me the totals work correctly. Please double-check your data, metric, and chosen aggregation. You can perhaps best sanity-check it using some simple metric like count(*) and SUM aggregation.
Thursday - last edited Thursday
Hi @OndrejHavlicek, your statement and implication appear correct, if I understand accurately.
The "Grand Total" line added by the "Display total" checkbox uses the same aggregate function as used for the individual rows in that column, but across all underlying data for that column, to get the Total-aggregate-result, called total (in widget config pane) and Grand Total (in row label).
I had been anticipating that the "Total" row added would always perform a "Sum" of the (potentially already aggregated) values above it.
My comment was related to the OP's topic that
@Diegol1337 wrote:...I want to be able to show a Total at the end of the table which sums the total ... of the column. Would also like for the Total to be flexible and always displayed....
Given this clarity:
Image
This is a contrived example, but we could get into what data shapes would make this valid, and why they are useful. Hopefully, that is not needed. In my current view, as a refinement from the image below, probably the "Display total" checkbox and optional "Grand Total" row can stay as they are as a feature; but "Total (Sum)" would be a good name for the distinct feature concept I was looking for (and, for a moment, thought I had found in this discussion!).
Passionate about hosting events and connecting people? Help us grow a vibrant local communityโsign up today to get started!
Sign Up Now