Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sum function against iif coulmn

Author  Topic 

sgarimella
Starting Member

3 Posts

Posted - 2009-07-29 : 09:30:52
Hi all,

I am facing problem in getting the total value of a column which has iif condition in its expression.

This is the expression of the coulmn.

=iif( (Cdbl(ReportItems!Beg_Balance.Value)+cdbl(Reportitems!Debit.value))-cdbl(ReportItems!Credit.value)>0,
(Cdbl(ReportItems!Beg_Balance.value)+cdbl(Reportitems!Debit.value))-cdbl(ReportItems!Credit.value),
Nothing)


Now in the table footer I need the total of this, I am trying to apply the sum function like

=sum(iif( (Cdbl(ReportItems!Beg_Balance.Value)+cdbl(Reportitems!Debit.value))-cdbl(ReportItems!Credit.value)>0,
(Cdbl(ReportItems!Beg_Balance.value)+cdbl(Reportitems!Debit.value))-cdbl(ReportItems!Credit.value),
Nothing))


but it is throwing error saying that " Aggregate functions can be used only on report items contained in page header and footers"

Can anybody help me in how to solve this problem.
Thanks in advance

Sateesh Garimella

sgarimella
Starting Member

3 Posts

Posted - 2009-07-29 : 14:30:40
Guys,

Can anybody please help on this. I need to solve this. Any work arounds please.

Thanks,

Sateesh Garimella
Go to Top of Page

SQLSoaker
Posting Yak Master

169 Posts

Posted - 2009-07-29 : 14:57:54
Assuming you are using SSRS, is this expression in the detail section of the report?
Go to Top of Page

sgarimella
Starting Member

3 Posts

Posted - 2009-07-29 : 15:33:16
Yes I am using SSRS only.

I am using the iif expression in Table detail section and I want the total in the table footer. I am facing problem when using Sum() in table footer for this.

Sateesh Garimella
Go to Top of Page
   

- Advertisement -