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
 Development Tools
 Reporting Services Development
 Reporting Problem with an Expression

Author  Topic 

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-06-12 : 11:17:31
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.

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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-12 : 13:10:12
Answered here:-
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=104727
Go to Top of Page

Rajesh Jonnalagadda
Starting Member

45 Posts

Posted - 2008-06-13 : 08:23:58
quote:
Originally posted by werhardt

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.

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



Rajesh Jonnalagadda
http://www.ggktech.com
Go to Top of Page

Rajesh Jonnalagadda
Starting Member

45 Posts

Posted - 2008-06-13 : 08:27:43


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


Rajesh Jonnalagadda
http://www.ggktech.com


Rajesh Jonnalagadda
http://www.ggktech.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-13 : 08:32:01
quote:
Originally posted by Rajesh Jonnalagadda



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


Rajesh Jonnalagadda
http://www.ggktech.com


Rajesh Jonnalagadda
http://www.ggktech.com


Why are you posting the expression again?
Go to Top of Page

Rajesh Jonnalagadda
Starting Member

45 Posts

Posted - 2008-06-13 : 08:38:20
quote:
Originally posted by visakh16

quote:
Originally posted by Rajesh Jonnalagadda



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





Why are you posting the expression again?



i had written correct expression for the second expression in werhardt posting

Rajesh Jonnalagadda
http://www.ggktech.com
Go to Top of Page

Rajesh Jonnalagadda
Starting Member

45 Posts

Posted - 2008-06-13 : 08:52:14
quote:
Originally posted by Rajesh Jonnalagadda

quote:
Originally posted by visakh16

quote:
Originally posted by Rajesh Jonnalagadda



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





Why are you posting the expression again?



i had written correct expression for the second expression in werhardt posting

Rajesh Jonnalagadda
http://www.ggktech.com



Rajesh Jonnalagadda
http://www.ggktech.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-13 : 11:08:07
quote:
Originally posted by Rajesh Jonnalagadda

quote:
Originally posted by visakh16

quote:
Originally posted by Rajesh Jonnalagadda



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





Why are you posting the expression again?



i had written correct expression for the second expression in werhardt posting

Rajesh Jonnalagadda
http://www.ggktech.com


You have not handled division by 0. Imagine what happens when Fields!TotalChrgsQr3_2008.Value =0
Go to Top of Page

Rajesh Jonnalagadda
Starting Member

45 Posts

Posted - 2008-06-16 : 01:37:23

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




Rajesh Jonnalagadda
http://www.ggktech.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-16 : 02:15:16
quote:
Originally posted by Rajesh Jonnalagadda


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




Rajesh Jonnalagadda
http://www.ggktech.com


Didnt understand why you're concatenating the value with blank
Go to Top of Page
   

- Advertisement -