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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 IFF Statement

Author  Topic 

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-06-12 : 10:58:59
I am having trouble with my one IIF statment and I don't know what is going on. My first one worked on different fields. Here is the one that works,

=IIf(fields!clmNumberQtr3_2008.Value=0,"N/A",sum(Fields!clmNumberQtr3_2008.Value-Fields!clmNumberQtr3_2007.Value)/(Fields!clmNumberQtr3_2008.Value)*100 & "%")

This is the one that does not work. I have tried everything and it is still not working.

=IIF(Fields!TotalChrgsQr3_2008.Value<0,"N/A",sum(Fields!TotalChrgsQr3_2008.Value-Fields!TotalChrgsQrt3_2007.Value)/(Fields!TotalChrgsQr3_2008.Value))

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-12 : 11:06:39
Are you using this expression in SSRS? Post your question at Reporting Services Forum

Also, what do you mean by still not working?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-12 : 12:42:18
May be this
=IIF(Fields!TotalChrgsQr3_2008.Value<0,"N/A",IIF(Fields!TotalChrgsQr3_2008.Value>0,sum(Fields!TotalChrgsQr3_2008.Value-Fields!TotalChrgsQrt3_2007.Value)/(Fields!TotalChrgsQr3_2008.Value),0))
Go to Top of Page

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-06-12 : 13:16:58
Visakh16, I tried what you posted and I am still having problems. It says #ERORR

quote:
Originally posted by visakh16

May be this
=IIF(Fields!TotalChrgsQr3_2008.Value<0,"N/A",IIF(Fields!TotalChrgsQr3_2008.Value>0,sum(Fields!TotalChrgsQr3_2008.Value-Fields!TotalChrgsQrt3_2007.Value)/(Fields!TotalChrgsQr3_2008.Value),0))

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-12 : 13:19:28
does Fields!TotalChrgsQr3_2008.Value & Fields!TotalChrgsQrt3_2007.Value contain numeric values?
Go to Top of Page

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-06-12 : 13:29:38
It says (decimal(38,2),null)

Fields!TotalChrgsQr3_2008.Value has 0.00 and
Fields!TotalChrgsQrt3_2007.Value has 1,479,682.05
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-12 : 13:37:31
=IIF(CDbl(Fields!TotalChrgsQr3_2008.Value)<CDbl(0),"N/A",IIF(CDbl(Fields!TotalChrgsQr3_2008.Value)>CDbl(0),sum(Fields!TotalChrgsQr3_2008.Value-Fields!TotalChrgsQrt3_2007.Value)/(Fields!TotalChrgsQr3_2008.Value),0))
Go to Top of Page

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-06-12 : 13:42:54
I still have the Error. Maybe it has to do with my data.
Go to Top of Page
   

- Advertisement -