all groups > sql server reporting services > december 2005 >
You're in the

sql server reporting services

group:

Calculations at Run Time


Calculations at Run Time Vishal
12/22/2005 4:38:42 PM
sql server reporting services: Hi,

I am writting a report & want to calculate %age difference in last year &
current year's sales.

how do I write the expression or will have to write it in the SP I'm using
to run the report.

The problem is, I need to check the previous years sales value only if it is
greater than 0, then calculate the %age difference so it is something like
this

if prevYearSales > 0 then
currYearSales - prevYearSales / prevYearSales.

Thanks

RE: Calculations at Run Time Wayne Snyder
12/26/2005 4:49:01 AM
You do it in an SP or as the following report expression

=IIF(Fields!prevYearSales.Value > 0,
Fields!currYearSales.Value - FIelds!prevYearSales.Value /
Fields!prevYearSales.Value,0)

It sets other values to 0 (the last expression)
--
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC

I support the Professional Association for SQL Server ( PASS) and it''s
community of SQL Professionals.


[quoted text, click to view]
AddThis Social Bookmark Button