Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 28687

SSRS: Setting scope for custom code

$
0
0

I am using the following code:

Dim valuesAs System.Collections.ArrayList

Function AddValue(ByVal newValue AsDecimal)AsDecimal

  If (valuesIsNothing)Then

    values = New System.Collections.ArrayList()

  EndIf

  values.Add(newValue)

  AddValue = values.Count

EndFunction

 

Function GetPercentile(ByVal Percentile AsDecimal)AsDecimal

Dim countAsInteger = values.Count

Dim iLoopAsInteger = 1

Dim OnePartAsDecimal = 1 / (count - 1)

Dim PercentilePartAsDecimal = Percentile / OnePart

 

If Int(PercentilePart) = PercentilePartThen

  'is equal

  GetPercentile = values(PercentilePart)

Else

  'between two values

  Dim LowerAsDecimal = values(Int(PercentilePart))

  Dim HigherAsDecimal = values(Int(PercentilePart) + 1)

  Dim LowerPercentageAsDecimal = Int(PercentilePart) * OnePart

  Dim HigherPercentageAsDecimal = (Int(PercentilePart) + 1) * OnePart

 

GetPercentile = Lower + ((Higher - Lower) * ((Percentile - LowerPercentage) / (HigherPercentage - LowerPercentage)))

EndIf

EndFunction

Found here:

http://www.katieandemil.com/ssrs-percentile-function-2008-R2-calculation-custom-code-example

I am calling the GetPercentile function in a Table Group for month; the table is displaying data for the last 4 months.  The code does not use the Group scope (Month), but displays the same value for each month in the table.  How do limit the scope of the function?  I am using RB 2.0.


Viewing all articles
Browse latest Browse all 28687

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>