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
 Analysis Server and Reporting Services (2005)
 Expression Help

Author  Topic 

bendertez
Yak Posting Veteran

94 Posts

Posted - 2010-09-21 : 09:08:57
Hi

I have a simple expression which looks at two value fields (one current and one from the previous month) and does a comparison so I can see the rise or fall of the value on a month to month basis. This currently works okay:

=(Fields!PreviousTotal.Value)-(Fields!CurrentTotal.Value)

However sometimes there isn't a previous months value (i.e. from a new account) which then gives just me the amount of the current value as there is nothing to take away.

What I really want is a null value returning where there is no PreviousTotal rather than the difference.

Can this be done within the expression?

Thanks in advance

Dave

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-09-21 : 12:25:19
=IIF(Len(Fields!PreviousTotal.Value)>0,(Fields!PreviousTotal.Value)-(Fields!CurrentTotal.Value),Nothing)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

bendertez
Yak Posting Veteran

94 Posts

Posted - 2010-09-24 : 08:50:31
Thanks Visakh, that's worked perfectly.
Go to Top of Page
   

- Advertisement -