Reputation: 324
Is there a way to use multi-table data in CrossTable together with Sum aggregation? Sample data looks like this:
UniqueCount(actid) aggregation works perfect with joined data:
But I have to calculate Sum of [bdg] column for each cell, and value for each distinct [actid] should be counted once. When using simply Sum(bdg) values are calculated expected incorrectly:
Highlited values should be 1010 and 1110 in this case.
Does anyone have an idea how to get this working as required? Maybe there is some way to use related data tables or implement "UniqueSum" aggregation...
Thanks in advance
Upvotes: 0
Views: 4442
Reputation: 324
Finally found required solution. First, adding couple of calculated columns to have [bdg] value only for single row per unique [actid]:
rank: Rank(RowId(),"desc",[actid])
bdg_unq: If([rank]=1,[bdg],null)
Then we can use following expression as aggregation in cross table:
Sum([bdg_unq]) over (Intersect(All([Axis.Rows]),[Axis.Columns],[actid]))
Upvotes: 1
Reputation: 1648
Right click on the Sum(bdg) property and choose Custom Expression...
Try this:
Sum([bdg]) OVER ([actid])
This should slice the data over actid. Otherwise play around in there till you get what you want. Here's more info on the OVER function:
http://stn.spotfire.com/spotfire_client_help/ncfe/ncfe_over_functions.htm
Upvotes: 2