I would like to get percentage for a given field value. I am achieving this in excel by using formula. Is there a way to write down formula in SSRS?
I attached images here.
I need this
In excel i achieved by using formula, how to get this one in SSRS?
Yes, It's possible.
Use below expression
=Round(100 * (ReportItems!Number.Value / ReportItems!Number1.Value),2)
Here, ReportItems!Number.Value is the textbox name of Name Texbox and ReportItems!Number1.Value is the textbox name of Total Textbox.
See the below Image, It's working fine.
To Get Sum of percentage.
I would suggest to follow below things,
Go to Report properties, then Go To Code and then create the following function.
Public Sum_Perc As Integer = 0
Public Function PercentageSum(ByVal value As Integer) As Integer
Sum_Perc = Sum_Perc + value
Return Sum_Perc
End Function
Now, beside Name - Create Placeholder and set font to white as we don't required to show calculation on this cell. Do like below image.
Now, Set Expression like below image and text like this,
=Code.Sum_Perc
Hope, It will be helpful to you. Thanks
I used this custom code to get the percentage sum
Public Total_lookup_Sum As Integer = 0
Public Function Lookup_Sum(ByVal value As Integer) As Integer
Total_lookup_Sum = Total_lookup_Sum + value
Return Total_lookup_Sum
End Function
and i used this expression in tablix
=round(100*code.lookup_Sum(Reportitems!Textbox34.value),2)
source here