

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sum Aggr Sum with multiple set analysis query
Hi all,
I have an expression where I need to use multiple set analysis criteria. A simplified version is below
Sum({<Set Analysis Criteria 1>} Aggr (Sum {<Set Analysis Criteria 1>} Sales), Division))
+
Sum({<Set Analysis Criteria 2>} Aggr (Sum {<Set Analysis Criteria 2>} Sales), Division))
I was hoping and expecting that I could combine them into a simpler version, e.g.
Sum({<Set Analysis Criteria 1>+<Set Analysis Criteria 2>}
Aggr (
Sum {<Set Analysis Criteria 1>+<Set Analysis Criteria 2>} Sales), Division))
but this isnt giving me the same answer.
Does it not work like this? Or is it not working in mine becuse of the set analysis criteria I am using?
I would be grateful of any help.
Also, as a side question, do I necessary need the same Set analysis criteria after both "sums" in a sum-aggr-sum expression?
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Another way to do this would be (not that it would be any better)
Sum(Aggr(
RangeSum(Sum({<Transaction_Type={'C'}>}Value),
-Sum({<Transaction_Type={'C'}, Customer_Name={'Void'}>}Value),
-Sum({<Transaction_Type={'C'}, Customer_Type={2}, Customer_Name={'*'}-{'Void'}>}Value))
, CustomerID, Week))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not always are they going to work... if the set analysis overlap, the sum from the two expressions can overlap and the two expressions can give you very different numbers.
For your second question, it usually makes sense to add the same set analysis from your inner aggregation to your outer aggregation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please post full metric to check


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My real expression is something more like
Sum ({<Transaction_Type={'C'}>}
Aggr (Sum {<Transaction_Type={'C'}>}Value), CustomerID, Week))
-
Sum ({<Transaction_Type={'C'}, Customer_Name={'Void'}>}
Aggr (Sum {<Transaction_Type={'C'}, Customer_Name={'Void'}>}Value), CustomerID, Week))
-
Sum ({<Transaction_Type={'C'}, Customer_Type={2}, Customer_Name={'*'}-{'Void'}>}
Aggr (Sum {<Transaction_Type={'C'}, Customer_Type={2}, Customer_Name={'*'}-{'Void'}>}Value), CustomerID, Week))
So, its a case of
Show me the sum off all C transactions
Less all C transactions for Voids
Less all C transactions for Type 2 customers except Voids (as they have been excluded above)
If someone can show me a better / cleaner way of writing that, I would appreciate it

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Another way to do this would be (not that it would be any better)
Sum(Aggr(
RangeSum(Sum({<Transaction_Type={'C'}>}Value),
-Sum({<Transaction_Type={'C'}, Customer_Name={'Void'}>}Value),
-Sum({<Transaction_Type={'C'}, Customer_Type={2}, Customer_Name={'*'}-{'Void'}>}Value))
, CustomerID, Week))


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
in which object you are using the expression ? as you are using aggr(sum() it must be a text box.
Karl Hart wrote:
So, its a case of
Show me the sum off all C transactions
Less all C transactions for Voids
Less all C transactions for Type 2 customers except Voids (as they have been excluded above)
If someone can show me a better / cleaner way of writing that, I would appreciate it
when you said less all you meant diffrence or exclusion ? if exclusion and i understood it correctly than you dont need a complex expression.
.png)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI,
try this
Sum(
Aggr(
Sum ( {<Transaction_Type={'C'} , Customer_Type-={2} , Customer_Name-={'Void'}>} Value)
, CustomerID, Week
)
)


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, that has worked and reduced the calculation time - which is what I was trying to achieve with this


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, I did think about this after I posted the question, but there is another criteria which I didnt include which means there is some overlapping and so this wouldnt work in my case
