Measure aggregate formula ommit filters
Hi all,
I need to calculate an aggregate in an Analysis but I have the following issue. What I need is the last column measure "NC Todas MES". It is the Total Result for Month (Año-Mes). I have calculated it with an AGGREGATE AT or SUM BY expression.
So, this is correct:
But if I filter for some "Dpto.NC", for example:
This is the new Result:
What I need is the filtered result also for "NC Todas MES". It would be "5" for 201601 and "5" for 201602.
Could someone help me with this?
Thank you!!
Answers
-
This is an expected behaviour: Logical SQL Reference - 11g Release 1 (11.1.1)
AGGREGATE AT
This function aggregates columns based on the level or levels you specify. Using
AGGREGATE AT
guarantees that the aggregate for the measure always occurs at the levels specified after the keywordAT
, regardless of theWHERE
clause.Try to use Aggregate("measure" by "table name"."Año-Mes") instead.
0 -
Thank you Andrew,
I know this is an expected behaviour, but I need to know how to get the result that I need.
Using both, AGGREGATE AT or "Aggregate("measure" by "table name"."Año-Mes") the result is the same.
The calculation that I need has to be done after applying the filters to the analysis.
Any other idea?
0 -
Aggregate(... by ...) and aggregate(... at ...) don't work the same. Aggregate AT ignores LOB filter, Aggregate BY - not.
It is possible that I don't understand what is the problem. Try to reproduce it with the default sample model so it's possible to discuss it more precisely.
0 -
Thank you Andrew,
You are right, I've reproduced your same example with the sample model and I can see the difference between AggregateBY and AggregateAT.
Taking my own model, I have realized that with other attributes in the dimension (defined in a different level) is working correctly, but I cannot reproduce the difference using the attribute "Dpto.NC", the result is the same in both formulas.
So, I'm going to check the model, it must be something there.
Thank you again!
0 -
I'd recommend you to start with hierarchy keys check. From my experience, incorrectly defined keys are the most often cause of the strange behaviour like this.
0