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)
 how to compare %value in expression

Author  Topic 

sachya45
Starting Member

25 Posts

Posted - 2009-07-08 : 15:59:47
Hi All,
I am trying to create one column in my report table.
where condition is if money drawn(calculated field) is greater than 10% of money available(field from database)
change status field to 1 or 2.
please advise how to get this expression working with report detail column Status.

Thanks.

VipulM
Starting Member

9 Posts

Posted - 2009-07-09 : 02:36:24
Try following expression in your status column:

IIf((Fields!money_drawn.Value > (Fields!money_available.Value)*0.1),"1","2")



Cheers !!
Vipul
Go to Top of Page

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-07-09 : 04:34:23
declare @val1 int, @val2 int
select @val1 = 4, @val2 = 220

select convert(decimal(5,2), 100.00 * @val1/@val2)

In this case, putting the 100.00 first, cause SQL Server to use decimal math. The convert() function rounds to 2 decimal places.



-------------------------
R..
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-09 : 10:47:50
i prefer to do this in reports so would have gone for first suggestion
Go to Top of Page

sachya45
Starting Member

25 Posts

Posted - 2009-07-09 : 11:24:39
Thank You All...
I got it in Report.

Thanks Again..
Go to Top of Page
   

- Advertisement -