Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Are the values of Row 1 and Row 5 constant, or will the row numbers you are calculating on always be 1 and 5?</p> <p>You could use custom code to store the values in variables and then perform the calculation using those. </p> <p>Create a function which takes both Col1 value and the calculated value of Col2. It will then assign Row1 to var1 and Row5 to var2. It will then return the value of Col2 for display as the Total value. </p> <p>Make sense? Let me know if you need some help with the function... </p> <p><em>EDIT</em> </p> <p>SSRS:</p> <pre><code> Col 1 | Col 2 | Col 2 Expression England | 201 | =Code.SetOneFive(Count(Fields!Country.Value)) Ireland | 451 | =Code.SetOneFive(Count(Fields!Country.Value)) Scotland | 215 | =Code.SetOneFive(Count(Fields!Country.Value)) Wales | 487 | =Code.SetOneFive(Count(Fields!Country.Value)) Zenovia | 2145 | =Code.SetOneFive(Count(Fields!Country.Value)) </code></pre> <p>Code: </p> <pre><code> Public Shared Dim i as Integer = 1 Public Shared Dim rowOne as Integer Public Shared Dim rowFive as Integer Public Function SetOneFive (byval _OneFive As Integer) as Integer If i = 1 then rowOne = _OneFive Else If i = 5 then rowFive = _Onefive End If i = i + 1 End Function Public Function GetRowOne () As Integer GetRowOne = RowOne End Function Public Function GetRowFive () As Integer GetRowFive = RowFive End Function </code></pre> <p>For every iteration of the code, i is increased by 1. This is checked every iteration for a value of 1 or 5.</p> <p>In your total column you can then use:</p> <pre><code> =Code.GetRowFive() / Code.GetRowOne() </code></pre> <p>Note: I haven't tested this so there could be some typos or syntactical errors, but you get the general idea.</p> <p>Depending on how you use this you may want to consider not declaring the variables as 'shared':</p> <p><a href="https://stackoverflow.com/questions/2784473/ssrs-code-variable-resetting-on-new-page">SSRS code variable resetting on new page</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload