Spotfire - 查找小计的百分比

Spotfire - Finding Percentage of Subtotals

I'm trying to turn a cross table that looks like this

into a table which shows the subtotals and percentage over each Group like the example below

Where the percentage is the sales of each product divided by the total sales in each group, so for Product A = 20 / (20+40+30) = 22%

So far, I've managed to use Spotfire built-in subtotal function and the following expression to almost achieved the table I want

Sum([Sales) / Sum([Sales]) OVER (Intersect(Parent([Axis.Rows]),All([Axis.Rows])))

but the only problem is that the percentage for my subtotal row doesn't seems to equal to 100%, instead it is taking the subtotal sales divided by the grand total for all groups, meaning 90 / (90+140) = 39%

Can anyone advise me where did I go wrong and how do I resolve this?谢谢

您在任何地方都没有出错,但您的小计不会按照您想要的方式计算。小计由 Spotfire 根据基础分组数据自动计算。所以在这种情况下,小计将用于层次结构(组)的第一个节点。即第 1 组和第 2 组。您将无法使用当前布局更改它。如您所知,小计是总计的一部分。总计是整个 Cross Table 的总和,无论您的数据是什么,总计都是 100%。因此,2 个或多个小计的总和不可能 > 100%。您的小计是根据此公式计算出的值的总和:

Sum([Sales]) THEN [Value] / Sum([Value]) OVER (All([Axis.Rows])) as [% of Total]