Grand Total Issue in Cross Table of Spotfire

给你一囗甜甜゛ 提交于 2019-12-07 16:02:18

问题


When I use FIRST(CG1) in 'Cell Values' the grand total is not summing up instead its showing one of the values from the result of FIRST(CG1).

Please advise if we have to always use sum(XXX) to get the grand total summed up.


回答1:


Short answer, yes if you want the Grand Total to be a summation of your data. Applying a grand total to a different aggregation will have different results.

  • AVG will average the averages of your Category Axis
  • MAX will take the MAX of the Max for each category
  • Cumulative Sum will take the "Last" value in your Category since it doesn't have any additional values to SUM up.
  • Product will take the Product of Products
  • First and Last you are already aware of.



回答2:


Long Answer:

You actually CAN sum the first value of a column from a column grouping.

For example, consider the following data set.

[Grouping] [Food] [Color] [Weight]
Fruit Apple Yellow 4
Fruit Apple Green 2
Fruit Apple Red 4
Fruit Banana Yellow 5
Fruit Banana Brown 2
Fruit Orange Orange 3
Vegetable Carrot Orange 4

If, in your custom expression, you put

Sum(if(RankReal([Grouping], "ties.method=first", [Food]) = 1, [Weight], 0))

it will find the first instance of each food in your data set, so regardless of how you group the left, your results, subtotals, and grand totals will sum only the first instance of each food.

So you will be able to see the following:

Fruit     Apple        4
            Banana     5
            Orange     3
            Subtotal:  12
Vegetable Carrot  4
            Subtotal:   4
Grand Total:        16



来源:https://stackoverflow.com/questions/40171345/grand-total-issue-in-cross-table-of-spotfire

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!