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
 Getting NaN value

Author  Topic 

latingntlman
Yak Posting Veteran

96 Posts

Posted - 2008-06-06 : 13:07:54
I'm calculating Average Ticket Order for a group:

=sum( Fields!TtlSales.Value) /
sum( Fields!TtlOrders.Value)

But I noticed that when Sales and Orders are 0 then NaN value displays.

Has anyone got this value before? if so, how do I counter for it?

thx,

John

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-06-06 : 13:14:04
It is not possible to divide anything by 0. For your report, use an Iif statement to handle this.

This has been asked before in these forums, so you might search on this to get an example solution. I don't have time to search for it right now.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-06 : 13:15:19
quote:
Originally posted by latingntlman

I'm calculating Average Ticket Order for a group:

=sum( Fields!TtlSales.Value) /
sum( Fields!TtlOrders.Value)

But I noticed that when Sales and Orders are 0 then NaN value displays.

Has anyone got this value before? if so, how do I counter for it?

thx,

John


=IIF(sum( Fields!TtlOrders.Value)>0,sum( Fields!TtlSales.Value) /
sum( Fields!TtlOrders.Value),0)
Go to Top of Page

latingntlman
Yak Posting Veteran

96 Posts

Posted - 2008-06-06 : 13:21:51
I actually knew you can't divide by zero. I guess I should've rephrased my question. I'm new w/SSRS 2000 and haven't found much help on different expressions.

Thanks for the help.

Go to Top of Page
   

- Advertisement -