apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
60.85k stars 13.18k forks source link

[Table][feedback needed] 'SHOW TOTALS' in Table chart #14061

Closed junlincc closed 5 months ago

junlincc commented 3 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

We recently added SUM/total control along with other enhancement to table chart, however, not all aggregations can be or should be summed, like average, max and min. In the second screenshot below, when the SHOW TOTALS check box is enabla the Totals row shows an average of the first column for AVG, max of the second column for COUNT, and the max of the third column for MAX. which are all very confusing.

Screen Shot 2021-04-09 at 1 15 47 PM Screen Shot 2021-04-09 at 1 24 38 PM

Describe the solution you'd like This was a known issue when we implement the enhancement, but there's no clear solution how we should approach it. we could either

Community, please try this new feature out and let us know how you would like us to improve the table chart.

appreciation to engineers who contributed to this enhanced, robust table viz. @villebro @ktmud @kgabryje

junlincc commented 3 years ago

Also, if we want to keep the AVG function, i notice we treated N/A value as 0. not sure this is ideal. thoughts?

pavlozt commented 3 years ago

@junlincc

  1. treating N/A as 0 it totally incorrect . Please don't do same mistakes again ( #12962 )
  2. it seems some strange things happened with sql alchemy and sums - #11658
junlincc commented 3 years ago

@pavlozt re: 1, thanks for the feedback that's what I thought as well :) cc @kgabryje @villebro

zhaoyongjie commented 3 years ago

I don't think it needs to change.

  1. In industry, Total does not mean arithmetically sum, but worthy of column(dimension) aggregation. For instance, Max measure in Tableau ground total:

image

cc: @junlincc

junlincc commented 3 years ago

Related https://github.com/apache/superset/issues/13847

ktmud commented 3 years ago

One bug report from our users:

Xnip2021-04-21_17-33-50

Per-column custom formatting is not applied to totals.

mistercrunch commented 3 years ago

For "show total" to be summing numeric fields regardless of whether the column is logically additive is totally ok. I believe that's what pivot tables do and what people expect.

NULL != 0!

betodealmeida commented 3 years ago

@junlincc we could always ask the user if the metric is additive:

  1. If the user adds a metric explicitly to the dataset we can have a checkbox asking if the metric is additive.
  2. For metrics defined on-the-fly with the "SIMPLE" tab we know if they're additive (COUNT, SUM) or not (COUNT DISTINCT, AVG, MIN, MAX).
  3. For metrics defined on-the-fly under "CUSTOM SQL" we can have a checkbox asking the user.

    we can also have a checkbox in the metric configuration dialog asking if the metric is additive, and have it disabled for aggregation functions that we know are not additive, like AVG and enabled for those we know are additive. This would work for the

junlincc commented 3 years ago

moving comments here @Phuc0077 let's continue discussion. https://github.com/apache/superset/issues/14639

Hi, I has just learn Superset apache and I has one trouble In Pivot Chart option, I chose:

Aggregation Function: Sum Check Show Total But in row All and column All are Max, not Sum Please help me. Thanks a lots.

kidbabyvu commented 3 years ago

moving comments here @Phuc0077 let's continue discussion.

14639

Hi, I has just learn Superset apache and I has one trouble In Pivot Chart option, I chose:

Aggregation Function: Sum Check Show Total But in row All and column All are Max, not Sum Please help me. Thanks a lots.

hi, I have stuck with this issue too,

when I tick on Show total checkbox with the Sum function, my expectations are the Total Column (Column All) shows the aggregation of the previous columns.

image

image

btw, could you show me how to change the name of Column All

besides, when I try the other function, suggest avg, It couldn't show the average value.

tks

junlincc commented 3 years ago

thank you everyone, for feedback!

@kidbabyvu please see video :)

https://user-images.githubusercontent.com/67837651/118920959-2d7ea800-b8ec-11eb-9354-114c5423cf25.mov

junlincc commented 3 years ago

btw, changing column name/adding label really should be an instant change. we should have the functionality in column formatting section. @mihir174

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

lameapparition commented 9 months ago

Hello, I'm new into Superset. Trying to move our analytics to this platform, but i met problem as I see no possibility of making Total row correct for non-countable (or non-additive) metric, guess it's related to this topic

SuperSet version: 3.0.0 Example: I have three metrics grouped by month:

  1. "spend plan" – amount of money company was planning to spend
  2. "spend fact" – amount of money company actually spended
  3. "spend rate" – ratio of spend fact and spend plan So, I created pivot table and added totals. "spend plan" and "spend fact" are ok – its totals are sums of all values but for "spend rate" I also see sums of all values instead of ratio of "spend fact" and "spend plan" totals image image

Expected result (using Google Spreadsheets):

image

Maybe I'm missing something, hope to get help

UPD. Found that usual table calculates "spend rate" correctly

image
rusackas commented 5 months ago

Closing this in favor of #25747. This one is a feature request rather than a bug. If this is relevant in current versions (currently 3.x) please open a new Ideas discussion for a feature request or a PR to address the problem.