Help -- SSRS Report expression
Hi
Say texbox1.value=2.58 and texbox2.value=2.70. I wanted to display these values in percentages so i formatted these cell to percentage with no decimals.
Now texbox1.value is displayed as 3% while actual value is 2.58 and textbox2.value is displayed as 3% while actual value is 2.70
expression
=iif(fields!textbox1.value>=fields!textbox2.value,"green","red") ----it gives red background for textbox1(as it compares with actual values), actually i want green background as both the textboxes displays as 3%
Is there any way to write background color expression comparing with display values not with actual values? or is there any work around?
Thanks
July 5th, 2011 5:28pm
See if this would work:
=iif(FormatNumber(fields!textbox1.value,0) >= FormatNumber(fields!textbox2.value,0) ,"green","red")
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2011 5:53pm
thanks for the reply but not working
July 5th, 2011 6:03pm
Hi Sam,
Please try this:
=IIF(ROUND(Fields!Textbox1.value)>=ROUND(Fields!Textbox2.value),"GREEN","RED")
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2011 6:30pm
thanks but no luck
July 5th, 2011 7:17pm
Try this
=IIF(CIELING(Fields!Textbox1.value)>=CIELING(Fields!Textbox2.value),"GREEN","RED")
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2011 7:37pm
Works for me.
=iif(FormatNumber(Fields!One.Value,0) = FormatNumber(Fields!two.Value,0),
"Green",
"Red")
July 6th, 2011 7:46am
Hi sam_01,
Thanks for your question and other partners’ replies. According to your description, it seems that you would like to round the two values,
2.58 and 2.70, then getting their percentages, finally, they both displayed as 3%, in addition, you would like to set the background color of the two textboxes, if its final percentage is 3%, in other word, if the round value greater than the
actual value, its background color will be green, right? If I misunderstand your question, please let me know.
Actually, in my opinion, you need not to compare textbox1’s value with textbox2’s value. The round function and the FormatPercent
function can help you achieve the requirement, for example:
For displaying the percentages of textbox1, please follow below expression,
=FormatPercent(Round(Fields!textbox1.Value)/100)
For the background color of textbox1, please follow below expression,
=Iif(Round(Fields!amount.Value)>Fields!textbox1.Value,"Green","Red")
Please repeat these expressions in textbox2.
Hope it helps you, if your issue still exists, please feel free to let me know.
Thanks,
Sharp Wang
Please remember to mark the replies as answers if they help you and unmark them if they provide no help.
Free Windows Admin Tool Kit Click here and download it now
July 6th, 2011 10:32pm