Attempted to divide by zero.
This is my sort expresion =IIF(Fields!Vta_Dolares.Value = 0, 0, Fields!Margen_Neto_Dolares.Value /Fields!Vta_Dolares.Value) even so, ..it shows error Greetings.
July 22nd, 2011 11:15am

Hi Augusto, Delete the sorting expression if you don't need it, or if you need it try this:- = IIf ( Fields!Vta_Dolares.Value = 0, Fields!Margen_Neto_Dolares.Value, Fields!Vta_Dolares.Value ) You cannot put numbers into your sorting expression, 0 or 4, etc etc this doesn't make any sense hence throwing an error message. Thanks KumarPlease do let us know your feedback. Thank You - KG, MCTS
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 11:26am

but this expression does not make what I want, I need to be ordered by the division Sum (Fields! Margen_Neto_Dolares.Value) / Sum (Fields! Vta_Dolares.Value)
July 22nd, 2011 11:32am

Can you tell me how you want to order? Can you please specific with an example?Please do let us know your feedback. Thank You - KG, MCTS
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 11:40am

is a simple sorting of a percentage margin, which is generated from the division of Sum (Fields! Margen_Neto_Dolares.Value) / Sum (Fields! Vta_Dolares.Value) To know which won more ..... https://skydrive.live.com/?mkt=es-es#!/?cid=24625b5eff4320c4&sc=documents&uc=1&id=24625B5EFF4320C4%21104!cid=24625B5EFF4320C4&id=24625B5EFF4320C4%21138&sc=documents
July 22nd, 2011 11:51am

Greetings. I have the following expression = Sum (Fields! Margen_Neto_Dolares.Value) / Sum (Fields! Vta_Dolares.Value) which gives me the warning [rsRuntimeErrorInExpression] The Value expression for the TextRun 'Textbox12.Paragraphs [0]. TextRuns [0]' contains an error: Attempted to divide by zero. How I can if you try to divide by zero the result is 0
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 3:56pm

Hi, I recommend to add a custom code function for the division (in Report -> Report Properties -> Code):- Public Function Divide(ByVal first As Double, ByVal second As Double) As Double If second = 0 Then Return 0 Else Return first / second End If End Function Then, modify the expression accordingly: = IIF(Fields!Qty.Value = 0, "None", Code.Divide(Fields!Hours.Value, Fields!Qty.Value)) OR IIf(Fields!Income2.Value = 0, nothing,Fields!Income.Value/Fields!Income2.Value) Please do let us know your feedback. Thank You Kumar - KG, MCTS
July 22nd, 2011 4:10pm

It shows me error when placing the function An error occurred processing report local DURING The definition of the report'/...... IS INVALID There is a error on line 0 of custom code: [BC30205] is expected END OF INSTRUCTION
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 4:32pm

Hi, Please paste your custom code, I think you are doing some minor mistake. Thanks KumarPlease do let us know your feedback. Thank You - KG, MCTS
July 22nd, 2011 4:40pm

I'm just copying and pasting yours.
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 4:42pm

= IIF(Sum(Fields!Vta_Dolares.Value) = 0, "None", Code.Divide(Sum(Fields!Margen_Neto_Dolares.Value), Sum(Fields!Vta_Dolares.Value))) I corrected but I get the word divided Unreconized identifier the warning is still displayed
July 22nd, 2011 4:59pm

I tried to validate this expression = IIF (Sum (Fields! Vta_Dolares.Value) = 0, 0, Sum (Fields! Margen_Neto_Dolares.Value) / Sum (Fields! Vta_Dolares.Value)) but show me the error The sort expression for the tablix contains an error.Attempted to divide by zero Please Help.
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 6:13pm

Hi August, Please read the error carefully, it looks like your sorting expression is wrong. Please correct your sorting expression. Thanks KumarPlease do let us know your feedback. Thank You - KG, MCTS
July 22nd, 2011 7:09pm

May be try this one... =iif(iif(sum(Fields!Vta_Dolares.Value)=0,0,sum(Fields!Margen_Neto_Dolares.Value)/iif(sum(Fields!Vta_Dolares.Value)=0,1,sum(Fields!Vta_Dolares.Value)))=0,0,iif(sum(Fields!Vta_Dolares.Value)=0,0,sum(Fields!Margen_Neto_Dolares.Value)/iif(sum(Fields!Vta_Dolares.Value)=0,1,sum(Fields!Vta_Dolares.Value)))) Pls mark as answer, if this helps- Kerobin
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2011 4:22am

Hi, Try this expression... =IIF(Sum (Fields! Vta_Dolares.Value) = 0, 0, Sum(Fields! Margen_Neto_Dolares.Value) / Sum(Fields! Vta_Dolares.Value)) Hope its helpful....Pavan Kokkula Tata Consultancy Services.
July 23rd, 2011 7:12am

Hi Augusto C, Please refer to the following article, and then check if it works for you, SQL Server Reporting Services (SSRS) – IIF statement divide by zero error: http://jcrawfor74.wordpress.com/2010/03/12/sql-server-reporting-services-ssrs-iif-statement-divide-by-zero-error/ If you have any question, please feel free to ask. Thanks, Eileen
Free Windows Admin Tool Kit Click here and download it now
July 24th, 2011 4:19am

_Kumar, The question remains the same, I have tried all methods posted and none work. The only thing that has changed is the field that is a calculated field. have an answer for that?? Sorry if I make you a hard time ..... :( Thank you.
August 27th, 2011 10:56am

Hi Augusto, Can you create a similar example what you are trying to do and what are you trying to achieve and paste us that .rdl file? From our side we will try to rectify your issue as early as possible. Thanks KumarPlease do let us know your feedback. Thank You - KG, MCTS
Free Windows Admin Tool Kit Click here and download it now
August 27th, 2011 11:29am

Hi August0 C = iif( Sum (Fields! Vta_Dolares.Value)=0,0,Sum (Fields! Margen_Neto_Dolares.Value) / Sum (Fields! Vta_Dolares.Value)) Please mark as answer if useful Amit
August 27th, 2011 12:01pm

Hi Augusto C, We are having hard time to understand your question which you are describing to us in different ways in every single reply. Can you elaborate your problem briefly at one SINGLE response? So that we can try to help you out to fix your issue at our best. Thanks KumarPlease do let us know your feedback. Thank You - KG, MCTS
Free Windows Admin Tool Kit Click here and download it now
August 27th, 2011 2:40pm

Thanks for the reply. I will review the information.
August 27th, 2011 5:27pm

Hello Augusto, I think you can try something like: =IIF(Sum (Fields! Vta_Dolares.Value) =0, 0, Sum (Fields! Margen_Neto_Dolares.Value) / Sum (Fields! Vta_Dolares.Value)). Hope it helped. Thank you, SammieRS. Sammie
Free Windows Admin Tool Kit Click here and download it now
August 27th, 2011 5:45pm

It does not work friends, thank you very much. I forgot to mention that this field does not retrieve the dataset, simply add as a calculated field and put it in a texbox
August 27th, 2011 6:23pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics