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 - 2008-06-12 : 08:04:47
|
| I am trying to take a string code seen below that gives me the income over a 12 month time frame but now I need to take this string and divide it by the acqcost. and it will not let me can you please take a look at this and see whats wrong.(This string is what gives me the income)=sum(Fields!Total.Value)-Sum(IIF(Fields!eqprecdt.Value< #6/1/2007#,Fields!bookvalue.Value* 0.07,Fields!bookvalue.Value* 0.07*-1 * datediff("d",#5/31/2008#,Fields!eqprecdt.Value)/365))(This string is the acq cost)SUM(Fields!acqcost.Value) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-12 : 08:07:09
|
| Whats the question? |
 |
|
|
midpenntech
Posting Yak Master
137 Posts |
Posted - 2008-06-12 : 08:16:38
|
| can i get help writing the line of code to divide the income string and the acq cost string so i can get the percent.This is the error message i get when i try to just take both strings and divide them.The Value expression for 'textbox52' contains an aggregate function (or RunningValue or RowNumber functions) in the argumant to another aggregate function (or RunningValue). Aggregate Functions cannot be nested inside other aggregate. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-12 : 08:57:03
|
| =IIF(SUM(Fields!acqcost.Value)>0,(sum(Fields!Total.Value)-Sum(IIF(Fields!eqprecdt.Value< #6/1/2007#,Fields!bookvalue.Value* 0.07,Fields!bookvalue.Value* 0.07*-1 * datediff("d",#5/31/2008#,Fields!eqprecdt.Value)/365)))/SUM(Fields!acqcost.Value),0) |
 |
|
|
midpenntech
Posting Yak Master
137 Posts |
Posted - 2008-06-12 : 09:30:52
|
| That worked what is the IIF mean and do for this statement. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-12 : 09:35:16
|
quote: Originally posted by midpenntech That worked what is the IIF mean and do for this statement.
IIF is immediate if. It works like CASE WHEN of T-SQL. it evaluates a condition and based on outcome executes True part or False part.It first checks if denominator expression is >0. if the result of this comparison is true then it will perform true part which is division. If its <0 then its false so it will perform false part which is 0 (just assigns it). |
 |
|
|
midpenntech
Posting Yak Master
137 Posts |
Posted - 2008-06-12 : 09:53:40
|
| that makes sence. Thank you so much. |
 |
|
|
|
|
|