Friday, February 24, 2012

Calculations at Run Time

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.
ThanksYou 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.
"Vishal" wrote:
> 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
>
>

No comments:

Post a Comment