Sunday, February 19, 2012

Filters in Aggregation Expressions

Pretend I have a table called Employees.
I want to know how many mend and women work for me.
Something like this:
=Count(IIF(Fields!EmployeeGender.Value = "M", 1, 0), Nothing)
=Count(IIF(Fields!EmployeeGender.Value = "F", 1, 0), Nothing)
Similarly I could get today's and yesterday's orders.
Something like this:
=Sum(IIF(Fields!OrderDate = Now, Fields!OrderTotal, 0), Nothing)
=Sum(IIF(Fields!OrderDate = Now-1, Fields!OrderTotal, 0), Nothing)
Is this possible and if not - what could I do to accomplish this?
I would prefer these two items to appear in the same TableRow.
Thanks in advance, JerryAs mentioned in the other thread "Does Sum not support Nothing scope?", you
may want to omit the scope argument of the aggregate function. Depending
where (header of groupings vs. detail) you move the textbox with the
aggregate function it will get different scopes if it is omitted.
If you always want to perform the aggregate calculations within a certain
containing scope (i.e. parent groups, parent data region scopes, data set
scope) you should explicitly specify them as scope argument.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jerry Nixon" <jerrynixon@.gmail.com> wrote in message
news:36f558cf.0410121238.73be231d@.posting.google.com...
> Pretend I have a table called Employees.
> I want to know how many mend and women work for me.
> Something like this:
> =Count(IIF(Fields!EmployeeGender.Value = "M", 1, 0), Nothing)
> =Count(IIF(Fields!EmployeeGender.Value = "F", 1, 0), Nothing)
> Similarly I could get today's and yesterday's orders.
> Something like this:
> =Sum(IIF(Fields!OrderDate = Now, Fields!OrderTotal, 0), Nothing)
> =Sum(IIF(Fields!OrderDate = Now-1, Fields!OrderTotal, 0), Nothing)
> Is this possible and if not - what could I do to accomplish this?
> I would prefer these two items to appear in the same TableRow.
> Thanks in advance, Jerry|||Thank you, that is good advice and it makes sense.
However, it does not answer why the following conditional aggregate fails:
=Count(IIF(Fields!EmployeeGender.Value = "M", 1, 0), Nothing)
=Count(IIF(Fields!EmployeeGender.Value = "M", 1, 0))
Thanks in advance, Jerry

No comments:

Post a Comment