|
|
Question : How to create a switch statement in a SSRS Expression, between specific values
|
|
Hi there,
I would like to know, how would I write the code in the textbox expression to have a switch statement, that changes the value of the output and shows only a certain percentage value of the output between a specific range.
The output is calculated as: sum(Fields!Deposit.Value)
The output would be changed as follows: 0 to 49999 we would like to see 4% of it 50000 to 99999 we would like to see 3.8% of it 100000 to 249999 we would like to see 3.75% of it 250000 to 499999 we would like to see 3.65% of it 500000 to 749999 we would like to see 3.50% of it 750000 or greater we would like to see 3.30% of it
Your help in creating a switch statement or method to put in the Expression would be most appreicated.
Many thanks in advance.
|
Answer : How to create a switch statement in a SSRS Expression, between specific values
|
|
Try this
=Sum(Fields!Deposit.Value) * switch(Sum(Fields!Deposit.Value)>=750000, 0.033, Sum(Fields!Deposit.Value)>=500000, 0.035, Sum(Fields!Deposit.Value)>=250000, 0.0365, Sum(Fields!Deposit.Value)>=100000, 0.0375, Sum(Fields!Deposit.Value)>=50000, 0.038, Sum(Fields!Deposit.Value)>=0, 0.04, true, 0)
The true statement at the end is a catch all, just in case you ever get any negative figures.
|
|
|
|
|