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.
| Author |
Topic |
|
midpenntech
Posting Yak Master
137 Posts |
Posted - 2009-04-16 : 14:32:36
|
| I have one current cell that sums up totals. See code for that below.=sum(Fields!Total.Value)-Sum(IIF(Fields!eqprecdt.Value< Parameters!fromdate.Value,Fields!bookvalue.Value* 0.07,Fields!bookvalue.Value* 0.07*-1 * datediff("d",Parameters!thrudate.Value,Fields!eqprecdt.Value)/365))This code sums up bookvalue. See below=SUM(Fields!bookvalue.Value)I need to be able to take the cell total and divide cell bookvalue to get the percent. But for some reason I am having an issue with it not calculating the correct fields.I thought it would look like this =sum(Fields!Total.Value)-Sum(IIF(Fields!eqprecdt.Value< Parameters!fromdate.Value,Fields!bookvalue.Value* 0.07,Fields!bookvalue.Value* 0.07*-1 * datediff("d",Parameters!thrudate.Value,Fields!eqprecdt.Value)/365))/ SUM(Fields!bookvalue.Value)But this does not give me the correct %. I think but i dont know how to write it is take the first code and do that first then take results of first code and divide that by sum bookvalue. Please help me |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-04-16 : 14:34:42
|
| may be this=(sum(Fields!Total.Value)-Sum(IIF(Fields!eqprecdt.Value< Parameters!fromdate.Value,Fields!bookvalue.Value* 0.07,Fields!bookvalue.Value* 0.07*-1 * datediff("d",Parameters!thrudate.Value,Fields!eqprecdt.Value)/365)))/ SUM(Fields!bookvalue.Value) |
 |
|
|
midpenntech
Posting Yak Master
137 Posts |
Posted - 2009-04-16 : 14:39:03
|
| damn i was close, all you added was the pran before sum and after 365 and that cased that whole section to do before all others. I thought about doing that but didnt. Thanks. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-04-16 : 14:40:58
|
| welcome...thats nothing but operator precedence which did you. it did a-(b/c) rather than (a-b)/c |
 |
|
|
|
|
|
|
|