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.
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 yourCategory Axis
MAX
will take theMAX
of theMax
for each categoryCumulative Sum
will take the "Last" value in yourCategory
since it doesn't have any additional values toSUM
up.Product
will take theProduct of Products
First
andLast
you are already aware of.
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