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
 IFF Expression to return 0 if field has no value

Author  Topic 

LOOKUP_BI
Constraint Violating Yak Guru

295 Posts

Posted - 2008-05-28 : 10:41:47
Hi All,

I have a table on my report that reads from a datasets, This dataset queries a table and returns 3 columns. [Month Name/ Monthly Count /Total].This report table works fine and returns me the month name together with each month count.The footer of the table,would display the Total[addition/sum of Monthly Count].

Problem Is :- When the Report Table is empty , no Month Name and Monthly Count.It returns an empty Total result.
I want it to return a '0' when there is no Monthly Count
.

I have tried the following expressions,but none worked.It does not return a 0.Any advise.Thanks

Example of Expressions:-
=IIF(Fields!MonthlyCount.Value=0,0,SUM(Fields!Total.Value))
=IIF(Fields!MonthlyCount.IS NOTHING,0,SUM(Fields!Total.Value))
Error [Hidden Expression return a data type value that is not Valid]

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-28 : 13:37:35
Try:-
=IIF(CountRows("YourDatasetName")=0,0,SUM(Fields!Total.Value))
Go to Top of Page

LOOKUP_BI
Constraint Violating Yak Guru

295 Posts

Posted - 2008-05-28 : 14:23:53
Thank You Visakh,

I have solved my problem by writing a VB function instead.
Go to Top of Page
   

- Advertisement -